|
1 | 1 | using System.Linq; |
2 | 2 | using ArchUnitNET.Domain; |
3 | 3 | using ArchUnitNET.Domain.Extensions; |
| 4 | +using ArchUnitNET.Loader; |
4 | 5 | using AttributeNamespace; |
5 | 6 |
|
6 | 7 | namespace ArchUnitNETTests.AssemblyTestHelper; |
7 | 8 |
|
8 | 9 | public class AttributeAssemblyTestHelpers : AssemblyTestHelper |
9 | 10 | { |
10 | | - public override Architecture Architecture |
11 | | - { |
12 | | - get => StaticTestArchitectures.AttributeArchitecture; |
13 | | - } |
14 | | - |
15 | | - public string NonExistentAttributeValue = "NotTheValueOfAnyAttribute"; |
16 | | - |
17 | | - public object Attribute1Parameter1Value = "Argument"; |
18 | | - public object Attribute1Parameter2Value = 0; |
19 | | - public object Attribute1Parameter3Value = typeof(TypeArgument); |
20 | | - public object Attribute1Parameter3InvalidValue = typeof(OtherTypeArgument); |
21 | | - |
22 | | - public string Attribute1NamedParameter1Name = "NamedParameter1"; |
23 | | - public object Attribute1NamedParameter1Value = typeof(NamedTypeArgument); |
24 | | - public (string, object) Attribute1NamedParameter1Pair = ( |
25 | | - "NamedParameter1", |
26 | | - typeof(NamedTypeArgument) |
27 | | - ); |
28 | | - public (string, object) Attribute1NamedParameter1InvalidNamePair = ( |
29 | | - "OtherNamedParameter1", |
30 | | - typeof(NamedTypeArgument) |
31 | | - ); |
32 | | - public (string, object) Attribute1NamedParameter1InvalidValuePair = ( |
33 | | - "NamedParameter1", |
34 | | - typeof(OtherNamedTypeArgument) |
35 | | - ); |
36 | | - public string Attribute1NamedParameter2Name = "NamedParameter2"; |
37 | | - public object Attribute1NamedParameter2Value = "NamedArgument"; |
38 | | - public (string, object) Attribute1NamedParameter2Pair = ("NamedParameter2", "NamedArgument"); |
39 | | - public (string, object) Attribute1NamedParameter2InvalidNamePair = ( |
40 | | - "OtherNamedParameter2", |
41 | | - "NamedArgument" |
42 | | - ); |
43 | | - public (string, object) Attribute1NamedParameter2InvalidValuePair = ( |
44 | | - "NamedParameter2", |
45 | | - "OtherNamedArgument" |
46 | | - ); |
47 | | - public string Attribute1NamedParameter3Name = "NamedParameter3"; |
48 | | - public object Attribute1NamedParameter3Value = 1; |
49 | | - public (string, object) Attribute1NamedParameter3Pair = ("NamedParameter3", 1); |
50 | | - |
51 | | - public object Attribute2Parameter1Value = typeof(OtherTypeArgument); |
52 | | - public object Attribute2Parameter2Value = "OtherArgument"; |
53 | | - public object Attribute2Parameter3Value = 2; |
54 | | - |
55 | | - public string Attribute2NamedParameter1Name = "OtherNamedParameter1"; |
56 | | - public object Attribute2NamedParameter1Value = "OtherNamedArgument"; |
57 | | - public (string, object) Attribute2NamedParameter1Pair = ( |
58 | | - "OtherNamedParameter1", |
59 | | - "OtherNamedArgument" |
60 | | - ); |
61 | | - public string Attribute2NamedParameter2Name = "OtherNamedParameter2"; |
62 | | - public object Attribute2NamedParameter2Value = 3; |
63 | | - public (string, object) Attribute2NamedParameter2Pair = ("OtherNamedParameter2", 3); |
64 | | - public string Attribute2NamedParameter3Name = "OtherNamedParameter3"; |
65 | | - public object Attribute2NamedParameter3Value = typeof(OtherNamedTypeArgument); |
66 | | - public (string, object) Attribute2NamedParameter3Pair = ( |
67 | | - "OtherNamedParameter3", |
68 | | - typeof(OtherNamedTypeArgument) |
69 | | - ); |
70 | | - |
71 | | - public string UnusedParameterName = "UnusedParameter"; |
72 | | - public object UnusedParameterValue = "UnusedValueArgument"; |
73 | | - public object UnusedTypeParameterValue = typeof(UnusedTypeArgument); |
| 11 | + public sealed override Architecture Architecture => |
| 12 | + StaticTestArchitectures.AttributeArchitecture; |
74 | 13 |
|
75 | 14 | public Attribute Attribute1; |
76 | 15 | public System.Type Attribute1SystemType = typeof(Attribute1); |
77 | 16 |
|
78 | 17 | public Attribute Attribute2; |
79 | 18 | public System.Type Attribute2SystemType = typeof(Attribute2); |
80 | 19 |
|
| 20 | + public Attribute Attribute3; |
| 21 | + public System.Type Attribute3SystemType = typeof(Attribute3); |
| 22 | + |
| 23 | + public Attribute OnceUsedAttribute; |
| 24 | + public System.Type OnceUsedAttributeSystemType = typeof(OnceUsedAttribute); |
| 25 | + |
81 | 26 | public Attribute UnusedAttribute; |
82 | 27 | public System.Type UnusedAttributeSystemType = typeof(UnusedAttribute); |
83 | 28 |
|
84 | 29 | public Class ClassWithoutAttributes; |
85 | 30 | public System.Type ClassWithoutAttributesSystemType = typeof(ClassWithoutAttributes); |
86 | 31 |
|
87 | | - public Class OtherClassWithoutAttributes; |
88 | | - public System.Type OtherClassWithoutAttributesSystemType = typeof(OtherClassWithoutAttributes); |
89 | | - |
90 | 32 | public Class ClassWithSingleAttribute; |
91 | 33 | public System.Type ClassWithSingleAttributeSystemType = typeof(ClassWithSingleAttribute); |
92 | 34 |
|
93 | | - public Class OtherClassWithSingleAttribute; |
94 | | - public System.Type OtherClassWithSingleAttributeSystemType = |
95 | | - typeof(OtherClassWithSingleAttribute); |
| 35 | + public Class ClassWithSingleUniquelyUsedAttribute; |
| 36 | + public System.Type ClassWithSingleUniquelyUsedAttributeSystemType = |
| 37 | + typeof(ClassWithSingleUniquelyUsedAttribute); |
| 38 | + |
| 39 | + public Class ClassWithTwoAttributes; |
| 40 | + public System.Type ClassWithTwoAttributesSystemType = typeof(ClassWithTwoAttributes); |
| 41 | + |
| 42 | + public Class ClassWithThreeAttributes; |
| 43 | + public System.Type ClassWithThreeAttributesSystemType = typeof(ClassWithThreeAttributes); |
| 44 | + |
| 45 | + public readonly string UnusedAttributeStringValue = "NotTheValueOfAnyAttribute"; |
| 46 | + public readonly int UnusedAttributeIntValue = 42; |
| 47 | + public readonly Class UnusedTypeArgument; |
| 48 | + public readonly System.Type UnusedTypeArgumentSystemType = typeof(UnusedTypeArgument); |
| 49 | + |
| 50 | + public readonly object Attribute1StringArgument = "Argument1"; |
| 51 | + public readonly object Attribute1IntegerArgument = 1; |
| 52 | + public readonly object Attribute1TypeArgument; |
| 53 | + public readonly object Attribute1TypeArgumentSystemType = typeof(TypeArgument1); |
| 54 | + |
| 55 | + public readonly object Attribute2StringArgument = "Argument2"; |
| 56 | + public readonly object Attribute2IntegerArgument = 2; |
| 57 | + public readonly object Attribute2TypeArgument; |
| 58 | + public readonly object Attribute2TypeArgumentSystemType = typeof(TypeArgument2); |
96 | 59 |
|
97 | | - public Class ClassWithAttributes; |
98 | | - public System.Type ClassWithAttributesSystemType = typeof(ClassWithAttributes); |
| 60 | + public readonly object Attribute3StringArgument = "Argument3"; |
| 61 | + public readonly object Attribute3IntegerArgument = 3; |
| 62 | + public readonly object Attribute3TypeArgument; |
| 63 | + public readonly object Attribute3TypeArgumentSystemType = typeof(TypeArgument3); |
99 | 64 |
|
100 | | - public Class OtherClassWithAttributes; |
101 | | - public System.Type OtherClassWithAttributesSystemType = typeof(OtherClassWithAttributes); |
| 65 | + public Class ClassWithSingleAttributeWithArguments; |
| 66 | + public System.Type ClassWithSingleAttributeWithArgumentsSystemType = |
| 67 | + typeof(ClassWithSingleAttributeWithArguments); |
102 | 68 |
|
103 | | - public Class ClassWithArguments; |
104 | | - public System.Type ClassWithArgumentsSystemType = typeof(ClassWithArguments); |
| 69 | + public Class ClassWithTwoAttributesWithArguments; |
| 70 | + public System.Type ClassWithTwoAttributesWithArgumentsSystemType = |
| 71 | + typeof(ClassWithTwoAttributesWithArguments); |
105 | 72 |
|
106 | | - public Class OtherClassWithArguments; |
107 | | - public System.Type OtherClassWithArgumentsSystemType = typeof(OtherClassWithArguments); |
| 73 | + public Class ClassWithThreeAttributesWithArguments; |
| 74 | + public System.Type ClassWithThreeAttributesWithArgumentsSystemType = |
| 75 | + typeof(ClassWithThreeAttributesWithArguments); |
| 76 | + |
| 77 | + public Class ClassWithSingleAttributeWithNamedArguments; |
| 78 | + public System.Type ClassWithSingleAttributeWithNamedArgumentsSystemType = |
| 79 | + typeof(ClassWithSingleAttributeWithNamedArguments); |
| 80 | + |
| 81 | + public Class ClassWithTwoAttributesWithNamedArguments; |
| 82 | + public System.Type ClassWithTwoAttributesWithNamedArgumentsSystemType = |
| 83 | + typeof(ClassWithTwoAttributesWithNamedArguments); |
| 84 | + |
| 85 | + public Class ClassWithThreeAttributesWithNamedArguments; |
| 86 | + public System.Type ClassWithThreeAttributesWithNamedArgumentsSystemType = |
| 87 | + typeof(ClassWithThreeAttributesWithNamedArguments); |
108 | 88 |
|
109 | 89 | public AttributeAssemblyTestHelpers() |
110 | 90 | { |
111 | 91 | Attribute1 = Architecture.GetAttributeOfType(typeof(Attribute1)); |
112 | 92 | Attribute2 = Architecture.GetAttributeOfType(typeof(Attribute2)); |
| 93 | + Attribute3 = Architecture.GetAttributeOfType(typeof(Attribute3)); |
| 94 | + OnceUsedAttribute = Architecture.GetAttributeOfType(typeof(OnceUsedAttribute)); |
113 | 95 | UnusedAttribute = Architecture.GetAttributeOfType(typeof(UnusedAttribute)); |
114 | 96 | ClassWithoutAttributes = Architecture.GetClassOfType(typeof(ClassWithoutAttributes)); |
115 | | - OtherClassWithoutAttributes = Architecture.GetClassOfType( |
116 | | - typeof(OtherClassWithoutAttributes) |
117 | | - ); |
118 | 97 | ClassWithSingleAttribute = Architecture.GetClassOfType(typeof(ClassWithSingleAttribute)); |
119 | | - OtherClassWithSingleAttribute = Architecture.GetClassOfType( |
120 | | - typeof(OtherClassWithSingleAttribute) |
| 98 | + ClassWithSingleUniquelyUsedAttribute = Architecture.GetClassOfType( |
| 99 | + typeof(ClassWithSingleUniquelyUsedAttribute) |
| 100 | + ); |
| 101 | + ClassWithTwoAttributes = Architecture.GetClassOfType(typeof(ClassWithTwoAttributes)); |
| 102 | + ClassWithThreeAttributes = Architecture.GetClassOfType(typeof(ClassWithThreeAttributes)); |
| 103 | + UnusedTypeArgument = Architecture.GetClassOfType(typeof(UnusedTypeArgument)); |
| 104 | + Attribute1TypeArgument = Architecture.GetClassOfType(typeof(TypeArgument1)); |
| 105 | + Attribute2TypeArgument = Architecture.GetClassOfType(typeof(TypeArgument2)); |
| 106 | + Attribute3TypeArgument = Architecture.GetClassOfType(typeof(TypeArgument3)); |
| 107 | + ClassWithSingleAttributeWithArguments = Architecture.GetClassOfType( |
| 108 | + typeof(ClassWithSingleAttributeWithArguments) |
| 109 | + ); |
| 110 | + ClassWithTwoAttributesWithArguments = Architecture.GetClassOfType( |
| 111 | + typeof(ClassWithTwoAttributesWithArguments) |
| 112 | + ); |
| 113 | + ClassWithThreeAttributesWithArguments = Architecture.GetClassOfType( |
| 114 | + typeof(ClassWithThreeAttributesWithArguments) |
| 115 | + ); |
| 116 | + ClassWithSingleAttributeWithNamedArguments = Architecture.GetClassOfType( |
| 117 | + typeof(ClassWithSingleAttributeWithNamedArguments) |
| 118 | + ); |
| 119 | + ClassWithTwoAttributesWithNamedArguments = Architecture.GetClassOfType( |
| 120 | + typeof(ClassWithTwoAttributesWithNamedArguments) |
| 121 | + ); |
| 122 | + ClassWithThreeAttributesWithNamedArguments = Architecture.GetClassOfType( |
| 123 | + typeof(ClassWithThreeAttributesWithNamedArguments) |
121 | 124 | ); |
122 | | - ClassWithAttributes = Architecture.GetClassOfType(typeof(ClassWithAttributes)); |
123 | | - OtherClassWithAttributes = Architecture.GetClassOfType(typeof(OtherClassWithAttributes)); |
124 | | - ClassWithArguments = Architecture.GetClassOfType(typeof(ClassWithArguments)); |
125 | | - OtherClassWithArguments = Architecture.GetClassOfType(typeof(OtherClassWithArguments)); |
126 | 125 | } |
127 | 126 | } |
0 commit comments