1- using System . Text . Json ;
2- using FluentAssertions ;
31using OpenFeature . Contrib . Providers . Flipt . Converters ;
42using OpenFeature . Model ;
3+ using System . Text . Json ;
54using Xunit ;
65
76namespace OpenFeature . Contrib . Providers . Flipt . Test ;
87
9- public class FlipExtensionsTest
8+ public class FliptExtensionsTest
109{
1110 [ Fact ]
1211 public void ToStringDictionary_WithEmptyContext_ShouldReturnEmptyDictionary ( )
1312 {
1413 var evaluationContext = EvaluationContext . Builder ( ) . Build ( ) ;
1514 var result = evaluationContext . ToStringDictionary ( ) ;
1615
17- result . Should ( ) . NotBeNull ( ) ;
18- result . Should ( ) . BeEmpty ( ) ;
16+ Assert . NotNull ( result ) ;
17+ Assert . Empty ( result ) ;
1918 }
2019
2120 [ Fact ]
@@ -27,9 +26,9 @@ public void ToStringDictionary_WithContext_ShouldReturnADictionaryWithValues()
2726 . Build ( ) ;
2827 var result = evaluationContext . ToStringDictionary ( ) ;
2928
30- result . Should ( ) . NotBeNull ( ) ;
31- result . Should ( ) . NotBeEmpty ( ) ;
32- result . Keys . Should ( ) . Contain ( "location" ) ;
29+ Assert . NotNull ( result ) ;
30+ Assert . NotEmpty ( result ) ;
31+ Assert . Contains ( "location" , result . Keys ) ;
3332 }
3433
3534 [ Fact ]
@@ -41,10 +40,12 @@ public void ToStringDictionary_WithContextAndIntegerValue_ShouldReturnADictionar
4140 . Build ( ) ;
4241 var result = evaluationContext . ToStringDictionary ( ) ;
4342
44- result . Should ( ) . NotBeNull ( ) ;
45- result . Should ( ) . NotBeEmpty ( ) ;
46- result . Keys . Should ( ) . Contain ( "age" ) ;
47- result [ "age" ] . Should ( ) . Be ( "23" ) ;
43+ Assert . NotNull ( result ) ;
44+ Assert . NotEmpty ( result ) ;
45+ Assert . Contains ( "age" , result . Keys ) ;
46+
47+ var actual = result [ "age" ] ;
48+ Assert . Equal ( "23" , actual ) ;
4849 }
4950
5051 [ Fact ]
@@ -62,14 +63,13 @@ public void ToStringDictionary_WithContextAndValuesOfStrings_ShouldReturnADictio
6263 . Build ( ) ;
6364 var result = evaluationContext . ToStringDictionary ( ) ;
6465
65- result . Should ( ) . NotBeNull ( ) ;
66- result . Should ( ) . NotBeEmpty ( ) ;
67- result . Keys . Should ( ) . Contain ( "config" ) ;
66+ Assert . NotNull ( result ) ;
67+ Assert . NotEmpty ( result ) ;
68+ Assert . Contains ( "config" , result . Keys ) ;
6869
69- JsonSerializer
70- . Deserialize < Structure > ( result [ "config" ] ,
71- JsonConverterExtensions . DefaultSerializerSettings ) . Should ( )
72- . BeEquivalentTo ( testStructure ) ;
70+ var expected = JsonSerializer . Serialize ( testStructure , JsonConverterExtensions . DefaultSerializerSettings ) ;
71+ var actual = result [ "config" ] ;
72+ Assert . Equal ( expected , actual ) ;
7373 }
7474
7575 [ Fact ]
@@ -88,21 +88,22 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio
8888 . Build ( ) ;
8989 var result = evaluationContext . ToStringDictionary ( ) ;
9090
91- result . Should ( ) . NotBeNull ( ) ;
92- result . Should ( ) . NotBeEmpty ( ) ;
93- result . Keys . Should ( ) . Contain ( "config" ) ;
91+ Assert . NotNull ( result ) ;
92+ Assert . NotEmpty ( result ) ;
93+ Assert . Contains ( "config" , result . Keys ) ;
9494
95- var deserialized = JsonSerializer . Deserialize < Structure > ( result [ "config" ] ,
96- JsonConverterExtensions . DefaultSerializerSettings ) ;
97- deserialized . Should ( ) . BeEquivalentTo ( testStructure ) ;
95+ var expected = JsonSerializer . Serialize ( testStructure , JsonConverterExtensions . DefaultSerializerSettings ) ;
96+ var actual = result [ "config" ] ;
97+ Assert . Equal ( expected , actual ) ;
9898 }
9999
100100 [ Fact ]
101101 public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADictionaryWithSerializedValues ( )
102102 {
103103 var sampleDictionary = new Dictionary < string , Value > ( ) ;
104104 sampleDictionary [ "config2" ] = new Value ( [
105- new Value ( [ new Value ( "element1-1" ) , new Value ( "element1-2" ) ] ) , new Value ( "element2" ) ,
105+ new Value ( [ new Value ( "element1-1" ) , new Value ( "element1-2" ) ] ) ,
106+ new Value ( "element2" ) ,
106107 new Value ( "element3" )
107108 ] ) ;
108109 sampleDictionary [ "config3" ] = new Value ( DateTime . Now ) ;
@@ -115,13 +116,13 @@ public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADic
115116 . Build ( ) ;
116117 var result = evaluationContext . ToStringDictionary ( ) ;
117118
118- result . Should ( ) . NotBeNull ( ) ;
119- result . Should ( ) . NotBeEmpty ( ) ;
120- result . Keys . Should ( ) . Contain ( "config" ) ;
119+ Assert . NotNull ( result ) ;
120+ Assert . NotEmpty ( result ) ;
121+ Assert . Contains ( "config" , result . Keys ) ;
121122
122- var deserialized = JsonSerializer . Deserialize < Structure > ( result [ "config" ] ,
123- JsonConverterExtensions . DefaultSerializerSettings ) ;
124- deserialized . Should ( ) . BeEquivalentTo ( testStructure ) ;
123+ var expected = JsonSerializer . Serialize ( testStructure , JsonConverterExtensions . DefaultSerializerSettings ) ;
124+ var actual = result [ "config" ] ;
125+ Assert . Equal ( expected , actual ) ;
125126 }
126127
127128 [ Fact ]
@@ -144,12 +145,12 @@ public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADicti
144145 . Build ( ) ;
145146 var result = evaluationContext . ToStringDictionary ( ) ;
146147
147- result . Should ( ) . NotBeNull ( ) ;
148- result . Should ( ) . NotBeEmpty ( ) ;
149- result . Keys . Should ( ) . Contain ( "config" ) ;
148+ Assert . NotNull ( result ) ;
149+ Assert . NotEmpty ( result ) ;
150+ Assert . Contains ( "config" , result . Keys ) ;
150151
151- var deserialized = JsonSerializer . Deserialize < Structure > ( result [ "config" ] ,
152- JsonConverterExtensions . DefaultSerializerSettings ) ;
153- deserialized . Should ( ) . BeEquivalentTo ( testStructure ) ;
152+ var expected = JsonSerializer . Serialize ( testStructure , JsonConverterExtensions . DefaultSerializerSettings ) ;
153+ var actual = result [ "config" ] ;
154+ Assert . Equal ( expected , actual ) ;
154155 }
155156}
0 commit comments