@@ -19,79 +19,79 @@ public interface IAsyncInterface
1919 }
2020
2121 [ Fact ]
22- public void ReturnsAsync_onSingleParameter_ParameterUsedForCalculationOfTheResult ( )
22+ public async Task ReturnsAsync_onSingleParameter_ParameterUsedForCalculationOfTheResult ( )
2323 {
2424 var mock = new Mock < IAsyncInterface > ( ) ;
2525 mock . Setup ( x => x . WithSingleParameterAsync ( It . IsAny < int > ( ) ) ) . ReturnsAsync ( ( int x ) => x * x ) ;
2626
27- int evaluationResult = mock . Object . WithSingleParameterAsync ( 2 ) . Result ;
27+ int evaluationResult = await mock . Object . WithSingleParameterAsync ( 2 ) ;
2828
2929 Assert . Equal ( 4 , evaluationResult ) ;
3030 }
3131
3232 [ Fact ]
33- public void ReturnsAsync_onSingleParameter_LazyEvaluationOfTheResult ( )
33+ public async Task ReturnsAsync_onSingleParameter_LazyEvaluationOfTheResult ( )
3434 {
3535 int coefficient = 5 ;
3636 var mock = new Mock < IAsyncInterface > ( ) ;
3737 mock . Setup ( x => x . WithSingleParameterAsync ( It . IsAny < int > ( ) ) ) . ReturnsAsync ( ( int x ) => x * coefficient ) ;
3838
39- int firstEvaluationResult = mock . Object . WithSingleParameterAsync ( 2 ) . Result ;
39+ int firstEvaluationResult = await mock . Object . WithSingleParameterAsync ( 2 ) ;
4040
4141 coefficient = 10 ;
42- int secondEvaluationResult = mock . Object . WithSingleParameterAsync ( 2 ) . Result ;
42+ int secondEvaluationResult = await mock . Object . WithSingleParameterAsync ( 2 ) ;
4343
4444 Assert . NotEqual ( firstEvaluationResult , secondEvaluationResult ) ;
4545 }
4646
4747 [ Fact ]
48- public void ReturnsAsync_onMultiParameter_ParametersUsedForCalculationOfTheResult ( )
48+ public async Task ReturnsAsync_onMultiParameter_ParametersUsedForCalculationOfTheResult ( )
4949 {
5050 var mock = new Mock < IAsyncInterface > ( ) ;
5151 mock . Setup ( x => x . WithMultiParameterAsync ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) ) . ReturnsAsync ( ( string first , string second ) => first + second ) ;
5252
53- string evaluationResult = mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) . Result ;
53+ string evaluationResult = await mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) ;
5454
5555 Assert . Equal ( "Moq4" , evaluationResult ) ;
5656 }
5757
5858 [ Fact ]
59- public void ReturnsAsync_onMultiParameter_LazyEvaluationOfTheResult ( )
59+ public async Task ReturnsAsync_onMultiParameter_LazyEvaluationOfTheResult ( )
6060 {
6161 var mock = new Mock < IAsyncInterface > ( ) ;
6262 mock . Setup ( x => x . WithMultiParameterAsync ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) ) . ReturnsAsync ( ( string first , string second ) => first + second ) ;
6363
64- string firstEvaluationResult = mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) . Result ;
65- string secondEvaluationResult = mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) . Result ;
64+ string firstEvaluationResult = await mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) ;
65+ string secondEvaluationResult = await mock . Object . WithMultiParameterAsync ( "Moq" , "4" ) ;
6666
6767 Assert . NotSame ( firstEvaluationResult , secondEvaluationResult ) ;
6868 }
6969
7070 [ Fact ]
71- public void ReturnsAsync_onParams_AllParametersUsedForCalculationOfTheResult ( )
71+ public async Task ReturnsAsync_onParams_AllParametersUsedForCalculationOfTheResult ( )
7272 {
7373 var mock = new Mock < IAsyncInterface > ( ) ;
7474 mock . Setup ( x => x . WithParamsAsync ( It . IsAny < DateTime [ ] > ( ) ) )
7575 . ReturnsAsync ( ( DateTime [ ] dateTimes ) => dateTimes . Max ( ) ) ;
7676
77- DateTime evaluationResult = mock . Object . WithParamsAsync ( DateTime . MinValue , DateTime . Now , DateTime . MaxValue ) . Result ;
77+ DateTime evaluationResult = await mock . Object . WithParamsAsync ( DateTime . MinValue , DateTime . Now , DateTime . MaxValue ) ;
7878
7979 Assert . Equal ( DateTime . MaxValue , evaluationResult ) ;
8080 }
8181
8282 [ Fact ]
83- public void ReturnsAsync_onParams_LazyEvaluationOfTheResult ( )
83+ public async Task ReturnsAsync_onParams_LazyEvaluationOfTheResult ( )
8484 {
8585 DateTime comparedDateTime = DateTime . MinValue ;
8686 var mock = new Mock < IAsyncInterface > ( ) ;
8787 mock . Setup ( x => x . WithParamsAsync ( It . IsAny < DateTime [ ] > ( ) ) )
8888 . ReturnsAsync ( ( DateTime [ ] dateTimes ) => dateTimes . Concat ( new [ ] { comparedDateTime } ) . Max ( ) ) ;
8989
9090 DateTime now = DateTime . Now ;
91- DateTime firstEvaluationResult = mock . Object . WithParamsAsync ( DateTime . MinValue , now ) . Result ;
91+ DateTime firstEvaluationResult = await mock . Object . WithParamsAsync ( DateTime . MinValue , now ) ;
9292
9393 comparedDateTime = DateTime . MaxValue ;
94- DateTime secondEvaluationResult = mock . Object . WithParamsAsync ( DateTime . MinValue , now ) . Result ;
94+ DateTime secondEvaluationResult = await mock . Object . WithParamsAsync ( DateTime . MinValue , now ) ;
9595
9696 Assert . NotEqual ( firstEvaluationResult , secondEvaluationResult ) ;
9797 }
0 commit comments