22using System . Threading ;
33using System . Threading . Tasks ;
44using BitFaster . Caching . Atomic ;
5- using FluentAssertions ;
5+ using Shouldly ;
66using Xunit ;
77
88namespace BitFaster . Caching . UnitTests . Atomic
@@ -14,53 +14,53 @@ public void DefaultCtorValueIsNotCreated()
1414 {
1515 var a = new AsyncAtomicFactory < int , int > ( ) ;
1616
17- a . IsValueCreated . Should ( ) . BeFalse ( ) ;
18- a . ValueIfCreated . Should ( ) . Be ( 0 ) ;
17+ a . IsValueCreated . ShouldBeFalse ( ) ;
18+ a . ValueIfCreated . ShouldBe ( 0 ) ;
1919 }
2020
2121 [ Fact ]
2222 public void WhenValuePassedToCtorValueIsStored ( )
2323 {
2424 var a = new AsyncAtomicFactory < int , int > ( 1 ) ;
2525
26- a . ValueIfCreated . Should ( ) . Be ( 1 ) ;
27- a . IsValueCreated . Should ( ) . BeTrue ( ) ;
26+ a . ValueIfCreated . ShouldBe ( 1 ) ;
27+ a . IsValueCreated . ShouldBeTrue ( ) ;
2828 }
2929
3030 [ Fact ]
3131 public async Task WhenValueCreatedValueReturned ( )
3232 {
3333 var a = new AsyncAtomicFactory < int , int > ( ) ;
34- ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 2 ) ) ) . Should ( ) . Be ( 2 ) ;
34+ ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 2 ) ) ) . ShouldBe ( 2 ) ;
3535
36- a . ValueIfCreated . Should ( ) . Be ( 2 ) ;
37- a . IsValueCreated . Should ( ) . BeTrue ( ) ;
36+ a . ValueIfCreated . ShouldBe ( 2 ) ;
37+ a . IsValueCreated . ShouldBeTrue ( ) ;
3838 }
3939
4040 [ Fact ]
4141 public async Task WhenValueCreatedWithArgValueReturned ( )
4242 {
4343 var a = new AsyncAtomicFactory < int , int > ( ) ;
44- ( await a . GetValueAsync ( 1 , ( k , a ) => Task . FromResult ( k + a ) , 7 ) ) . Should ( ) . Be ( 8 ) ;
44+ ( await a . GetValueAsync ( 1 , ( k , a ) => Task . FromResult ( k + a ) , 7 ) ) . ShouldBe ( 8 ) ;
4545
46- a . ValueIfCreated . Should ( ) . Be ( 8 ) ;
47- a . IsValueCreated . Should ( ) . BeTrue ( ) ;
46+ a . ValueIfCreated . ShouldBe ( 8 ) ;
47+ a . IsValueCreated . ShouldBeTrue ( ) ;
4848 }
4949
5050 [ Fact ]
5151 public async Task WhenValueCreatedGetValueReturnsOriginalValue ( )
5252 {
5353 var a = new AsyncAtomicFactory < int , int > ( ) ;
5454 await a . GetValueAsync ( 1 , k => Task . FromResult ( 2 ) ) ;
55- ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 3 ) ) ) . Should ( ) . Be ( 2 ) ;
55+ ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 3 ) ) ) . ShouldBe ( 2 ) ;
5656 }
5757
5858 [ Fact ]
5959 public async Task WhenValueCreatedArgGetValueReturnsOriginalValue ( )
6060 {
6161 var a = new AsyncAtomicFactory < int , int > ( ) ;
6262 await a . GetValueAsync ( 1 , ( k , a ) => Task . FromResult ( k + a ) , 7 ) ;
63- ( await a . GetValueAsync ( 1 , ( k , a ) => Task . FromResult ( k + a ) , 9 ) ) . Should ( ) . Be ( 8 ) ;
63+ ( await a . GetValueAsync ( 1 , ( k , a ) => Task . FromResult ( k + a ) , 9 ) ) . ShouldBe ( 8 ) ;
6464 }
6565
6666 [ Fact ]
@@ -70,9 +70,9 @@ public async Task WhenValueCreateThrowsValueIsNotStored()
7070
7171 Func < Task > getOrAdd = async ( ) => { await a . GetValueAsync ( 1 , k => throw new ArithmeticException ( ) ) ; } ;
7272
73- await getOrAdd . Should ( ) . ThrowAsync < ArithmeticException > ( ) ;
73+ var ex = await getOrAdd . ShouldThrowAsync < ArithmeticException > ( ) ; ;
7474
75- ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 3 ) ) ) . Should ( ) . Be ( 3 ) ;
75+ ( await a . GetValueAsync ( 1 , k => Task . FromResult ( 3 ) ) ) . ShouldBe ( 3 ) ;
7676 }
7777
7878 [ Fact ]
@@ -108,26 +108,26 @@ public async Task WhenCallersRunConcurrentlyResultIsFromWinner()
108108 await enter . Task ;
109109 resume . SetResult ( true ) ;
110110
111- ( await first ) . Should ( ) . Be ( result ) ;
112- ( await second ) . Should ( ) . Be ( result ) ;
111+ ( await first ) . ShouldBe ( result ) ;
112+ ( await second ) . ShouldBe ( result ) ;
113113
114- winnerCount . Should ( ) . Be ( 1 ) ;
114+ winnerCount . ShouldBe ( 1 ) ;
115115 }
116116
117117 [ Fact ]
118118 public void WhenValueNotCreatedHashCodeIsZero ( )
119119 {
120120 new AsyncAtomicFactory < int , int > ( )
121121 . GetHashCode ( )
122- . Should ( ) . Be ( 0 ) ;
122+ . ShouldBe ( 0 ) ;
123123 }
124124
125125 [ Fact ]
126126 public void WhenValueCreatedHashCodeIsValueHashCode ( )
127127 {
128128 new AsyncAtomicFactory < int , int > ( 1 )
129129 . GetHashCode ( )
130- . Should ( ) . Be ( 1 ) ;
130+ . ShouldBe ( 1 ) ;
131131 }
132132
133133 [ Fact ]
@@ -136,7 +136,7 @@ public void WhenValueNotCreatedEqualsFalse()
136136 var a = new AsyncAtomicFactory < int , int > ( ) ;
137137 var b = new AsyncAtomicFactory < int , int > ( ) ;
138138
139- a . Equals ( b ) . Should ( ) . BeFalse ( ) ;
139+ a . Equals ( b ) . ShouldBeFalse ( ) ;
140140 }
141141
142142 [ Fact ]
@@ -145,15 +145,15 @@ public void WhenOtherValueNotCreatedEqualsFalse()
145145 var a = new AsyncAtomicFactory < int , int > ( 1 ) ;
146146 var b = new AsyncAtomicFactory < int , int > ( ) ;
147147
148- a . Equals ( b ) . Should ( ) . BeFalse ( ) ;
148+ a . Equals ( b ) . ShouldBeFalse ( ) ;
149149 }
150150
151151 [ Fact ]
152152 public void WhenArgNullEqualsFalse ( )
153153 {
154154 new AsyncAtomicFactory < int , int > ( 1 )
155155 . Equals ( null )
156- . Should ( ) . BeFalse ( ) ;
156+ . ShouldBeFalse ( ) ;
157157 }
158158
159159 [ Fact ]
@@ -163,7 +163,7 @@ public void WhenArgObjectValuesAreSameEqualsTrue()
163163
164164 new AsyncAtomicFactory < int , int > ( 1 )
165165 . Equals ( other )
166- . Should ( ) . BeTrue ( ) ;
166+ . ShouldBeTrue ( ) ;
167167 }
168168 }
169169}
0 commit comments