FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ArchUnitNET/ExampleTest/ExampleArchUnitTestCooking.cs at main · TNG/ArchUnitNET · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TNG
/
ArchUnitNET
Public
Notifications
You must be signed in to change notification settings
Fork
80
Star
1.4k
Code
Issues
21
Pull requests
10
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ArchUnitNET
/
ExampleTest
/
ExampleArchUnitTestCooking.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
94 lines (76 loc) · 2.37 KB
Breadcrumbs
ArchUnitNET
/
ExampleTest
/
ExampleArchUnitTestCooking.cs
Copy path
File metadata and controls
94 lines (76 loc) · 2.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
ArchUnitNET
.
Domain
;
using
ArchUnitNET
.
Domain
.
Extensions
;
using
ArchUnitNET
.
Loader
;
using
Xunit
;
// ReSharper disable NotAccessedField.Local
// ReSharper disable UnusedMember.Global
namespace
ExampleTest
{
public
class
ExampleArchUnitTestCooking
{
// initialize your test variables in the constructor
// TIP: access types of values from your architecture, then filter them using provided extension methods
public
ExampleArchUnitTestCooking
(
)
{
_chefs
=
ChefArchitecture
.
Classes
.
Where
(
cls
=>
cls
.
NameEndsWith
(
"Chef"
)
)
;
_cookInterface
=
ChefArchitecture
.
GetInterfaceOfType
(
typeof
(
ICook
)
)
;
}
// TIP: load your architecture once at the start to maximize performance of your tests
private
static
readonly
Architecture
ChefArchitecture
=
new
ArchLoader
(
)
.
LoadAssembly
(
typeof
(
FrenchChef
)
.
Assembly
)
.
Build
(
)
;
// replace <FrenchChef> with a class from your architecture
// declare variables you'll use throughout your tests up here
private
readonly
IEnumerable
<
Class
>
_chefs
;
private
readonly
Interface
_cookInterface
;
[
Fact
]
public
void
AllChefsCook
(
)
{
Assert
.
All
(
_chefs
,
chef
=>
Assert
.
True
(
chef
.
ImplementsInterface
(
_cookInterface
)
)
)
;
}
}
public
class
FrenchChef
:
ICook
{
private
int
_age
;
private
string
_name
;
public
FrenchChef
(
string
name
,
int
age
)
{
_name
=
name
;
_age
=
age
;
}
public
void
Cook
(
)
{
CremeBrulee
(
)
;
Crepes
(
)
;
Ratatouille
(
)
;
}
private
static
void
CremeBrulee
(
)
{
}
private
static
void
Crepes
(
)
{
}
private
static
void
Ratatouille
(
)
{
}
}
public
class
ItalianChef
:
ICook
{
private
int
_age
;
private
string
_name
;
public
ItalianChef
(
string
name
,
int
age
)
{
_name
=
name
;
_age
=
age
;
}
public
void
Cook
(
)
{
PizzaMargherita
(
)
;
Tiramisu
(
)
;
Lasagna
(
)
;
}
private
static
void
PizzaMargherita
(
)
{
}
private
static
void
Tiramisu
(
)
{
}
private
static
void
Lasagna
(
)
{
}
}
public
interface
ICook
{
void
Cook
(
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL