1
1
using System . Diagnostics . CodeAnalysis ;
2
2
using System . Threading . Tasks ;
3
3
using AutoFixture ;
4
- using FluentAssertions ;
5
4
using NSubstitute ;
6
5
using OpenFeature . Constant ;
7
6
using OpenFeature . Model ;
@@ -19,7 +18,7 @@ public void Provider_Must_Have_Metadata()
19
18
{
20
19
var provider = new TestProvider ( ) ;
21
20
22
- provider . GetMetadata ( ) . Name . Should ( ) . Be ( TestProvider . DefaultName ) ;
21
+ Assert . Equal ( TestProvider . DefaultName , provider . GetMetadata ( ) . Name ) ;
23
22
}
24
23
25
24
[ Fact ]
@@ -44,28 +43,23 @@ public async Task Provider_Must_Resolve_Flag_Values()
44
43
45
44
var boolResolutionDetails = new ResolutionDetails < bool > ( flagName , defaultBoolValue , ErrorType . None ,
46
45
NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ;
47
- ( await provider . ResolveBooleanValueAsync ( flagName , defaultBoolValue ) ) . Should ( )
48
- . BeEquivalentTo ( boolResolutionDetails ) ;
46
+ Assert . Equivalent ( boolResolutionDetails , await provider . ResolveBooleanValueAsync ( flagName , defaultBoolValue ) ) ;
49
47
50
48
var integerResolutionDetails = new ResolutionDetails < int > ( flagName , defaultIntegerValue , ErrorType . None ,
51
49
NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ;
52
- ( await provider . ResolveIntegerValueAsync ( flagName , defaultIntegerValue ) ) . Should ( )
53
- . BeEquivalentTo ( integerResolutionDetails ) ;
50
+ Assert . Equivalent ( integerResolutionDetails , await provider . ResolveIntegerValueAsync ( flagName , defaultIntegerValue ) ) ;
54
51
55
52
var doubleResolutionDetails = new ResolutionDetails < double > ( flagName , defaultDoubleValue , ErrorType . None ,
56
53
NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ;
57
- ( await provider . ResolveDoubleValueAsync ( flagName , defaultDoubleValue ) ) . Should ( )
58
- . BeEquivalentTo ( doubleResolutionDetails ) ;
54
+ Assert . Equivalent ( doubleResolutionDetails , await provider . ResolveDoubleValueAsync ( flagName , defaultDoubleValue ) ) ;
59
55
60
56
var stringResolutionDetails = new ResolutionDetails < string > ( flagName , defaultStringValue , ErrorType . None ,
61
57
NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ;
62
- ( await provider . ResolveStringValueAsync ( flagName , defaultStringValue ) ) . Should ( )
63
- . BeEquivalentTo ( stringResolutionDetails ) ;
58
+ Assert . Equivalent ( stringResolutionDetails , await provider . ResolveStringValueAsync ( flagName , defaultStringValue ) ) ;
64
59
65
60
var structureResolutionDetails = new ResolutionDetails < Value > ( flagName , defaultStructureValue ,
66
61
ErrorType . None , NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ;
67
- ( await provider . ResolveStructureValueAsync ( flagName , defaultStructureValue ) ) . Should ( )
68
- . BeEquivalentTo ( structureResolutionDetails ) ;
62
+ Assert . Equivalent ( structureResolutionDetails , await provider . ResolveStructureValueAsync ( flagName , defaultStructureValue ) ) ;
69
63
}
70
64
71
65
[ Fact ]
@@ -113,32 +107,32 @@ public async Task Provider_Must_ErrorType()
113
107
NoOpProvider . ReasonNoOp , NoOpProvider . Variant ) ) ;
114
108
115
109
var boolRes = await providerMock . ResolveBooleanValueAsync ( flagName , defaultBoolValue ) ;
116
- boolRes . ErrorType . Should ( ) . Be ( ErrorType . General ) ;
117
- boolRes . ErrorMessage . Should ( ) . Be ( testMessage ) ;
110
+ Assert . Equal ( ErrorType . General , boolRes . ErrorType ) ;
111
+ Assert . Equal ( testMessage , boolRes . ErrorMessage ) ;
118
112
119
113
var intRes = await providerMock . ResolveIntegerValueAsync ( flagName , defaultIntegerValue ) ;
120
- intRes . ErrorType . Should ( ) . Be ( ErrorType . ParseError ) ;
121
- intRes . ErrorMessage . Should ( ) . Be ( testMessage ) ;
114
+ Assert . Equal ( ErrorType . ParseError , intRes . ErrorType ) ;
115
+ Assert . Equal ( testMessage , intRes . ErrorMessage ) ;
122
116
123
117
var doubleRes = await providerMock . ResolveDoubleValueAsync ( flagName , defaultDoubleValue ) ;
124
- doubleRes . ErrorType . Should ( ) . Be ( ErrorType . InvalidContext ) ;
125
- doubleRes . ErrorMessage . Should ( ) . Be ( testMessage ) ;
118
+ Assert . Equal ( ErrorType . InvalidContext , doubleRes . ErrorType ) ;
119
+ Assert . Equal ( testMessage , doubleRes . ErrorMessage ) ;
126
120
127
121
var stringRes = await providerMock . ResolveStringValueAsync ( flagName , defaultStringValue ) ;
128
- stringRes . ErrorType . Should ( ) . Be ( ErrorType . TypeMismatch ) ;
129
- stringRes . ErrorMessage . Should ( ) . Be ( testMessage ) ;
122
+ Assert . Equal ( ErrorType . TypeMismatch , stringRes . ErrorType ) ;
123
+ Assert . Equal ( testMessage , stringRes . ErrorMessage ) ;
130
124
131
125
var structRes1 = await providerMock . ResolveStructureValueAsync ( flagName , defaultStructureValue ) ;
132
- structRes1 . ErrorType . Should ( ) . Be ( ErrorType . FlagNotFound ) ;
133
- structRes1 . ErrorMessage . Should ( ) . Be ( testMessage ) ;
126
+ Assert . Equal ( ErrorType . FlagNotFound , structRes1 . ErrorType ) ;
127
+ Assert . Equal ( testMessage , structRes1 . ErrorMessage ) ;
134
128
135
129
var structRes2 = await providerMock . ResolveStructureValueAsync ( flagName2 , defaultStructureValue ) ;
136
- structRes2 . ErrorType . Should ( ) . Be ( ErrorType . ProviderNotReady ) ;
137
- structRes2 . ErrorMessage . Should ( ) . Be ( testMessage ) ;
130
+ Assert . Equal ( ErrorType . ProviderNotReady , structRes2 . ErrorType ) ;
131
+ Assert . Equal ( testMessage , structRes2 . ErrorMessage ) ;
138
132
139
133
var boolRes2 = await providerMock . ResolveBooleanValueAsync ( flagName2 , defaultBoolValue ) ;
140
- boolRes2 . ErrorType . Should ( ) . Be ( ErrorType . TargetingKeyMissing ) ;
141
- boolRes2 . ErrorMessage . Should ( ) . BeNull ( ) ;
134
+ Assert . Equal ( ErrorType . TargetingKeyMissing , boolRes2 . ErrorType ) ;
135
+ Assert . Null ( boolRes2 . ErrorMessage ) ;
142
136
}
143
137
}
144
138
}
0 commit comments