@@ -41,167 +41,173 @@ public void BuildPagedResult_NulLArg_BuildsPagedResult()
4141
4242 #region CatchClientSideEvaluationException
4343 [ Fact ]
44- public void CatchClientSideEvaluationException_NotCCEE_ThrowsOriginalException ( )
44+ public async Task CatchClientSideEvaluationException_NotCCEE_ThrowsOriginalException ( )
4545 {
4646 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
4747 ApplicationException exception = new ( "Original exception" ) ;
4848
49- static void evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
49+ static Task evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
5050
51- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , evaluator ) ;
52- act . Should ( ) . Throw < ApplicationException > ( ) . WithMessage ( "Original exception" ) ;
51+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , evaluator ) ;
52+ ( await act . Should ( ) . ThrowAsync < ApplicationException > ( ) ) . WithMessage ( "Original exception" ) ;
5353 }
5454
5555 [ Fact ]
56- public void CatchClientSideEvaluationException_NotCCEE_WithInner_ThrowsOriginalException ( )
56+ public async Task CatchClientSideEvaluationException_NotCCEE_WithInner_ThrowsOriginalException ( )
5757 {
5858 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
5959 ApplicationException exception = new ( "Original exception" , new ApplicationException ( ) ) ;
6060
61- static void evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
61+ static Task evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
6262
63- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , evaluator ) ;
64- act . Should ( ) . Throw < ApplicationException > ( ) . WithMessage ( "Original exception" ) ;
63+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , evaluator ) ;
64+ ( await act . Should ( ) . ThrowAsync < ApplicationException > ( ) ) . WithMessage ( "Original exception" ) ;
6565 }
6666
6767 [ Fact ]
68- public void CatchClientSideEvaluationException_CCEE_ThrowsEvaluatorException ( )
68+ public async Task CatchClientSideEvaluationException_CCEE_ThrowsEvaluatorException ( )
6969 {
7070 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
7171 NotSupportedException exception = new ( "Original exception" , new ApplicationException ( "foo" ) ) ;
7272
73- static void evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
73+ static Task evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
7474
75- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , evaluator ) ;
76- act . Should ( ) . Throw < ApplicationException > ( ) . WithMessage ( "In evaluator" ) ;
75+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , evaluator ) ;
76+ ( await act . Should ( ) . ThrowAsync < ApplicationException > ( ) ) . WithMessage ( "In evaluator" ) ;
7777 }
7878
7979 [ Fact ]
80- public void CatchClientSideEvaluationException_CCEEInner_ThrowsEvaluatorException ( )
80+ public async Task CatchClientSideEvaluationException_CCEEInner_ThrowsEvaluatorException ( )
8181 {
8282 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
8383 ApplicationException exception = new ( "Original exception" , new NotSupportedException ( "foo" ) ) ;
8484
85- static void evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
85+ static Task evaluator ( ) { throw new ApplicationException ( "In evaluator" ) ; }
8686
87- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , evaluator ) ;
88- act . Should ( ) . Throw < ApplicationException > ( ) . WithMessage ( "In evaluator" ) ;
87+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , evaluator ) ;
88+ ( await act . Should ( ) . ThrowAsync < ApplicationException > ( ) ) . WithMessage ( "In evaluator" ) ;
8989 }
9090
9191 [ Fact ]
92- public void CatchClientSideEvaluationException_CCEE_ExecutesEvaluator ( )
92+ public async Task CatchClientSideEvaluationException_CCEE_ExecutesEvaluator ( )
9393 {
9494 bool isExecuted = false ;
9595 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
9696 NotSupportedException exception = new ( "Original exception" , new ApplicationException ( "foo" ) ) ;
97- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , ( ) => isExecuted = true ) ;
98- act . Should ( ) . NotThrow ( ) ;
97+
98+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , ( ) => { isExecuted = true ; return Task . CompletedTask ; } ) ;
99+ await act . Should ( ) . NotThrowAsync ( ) ;
99100 isExecuted . Should ( ) . BeTrue ( ) ;
100101 }
101102
102103 [ Fact ]
103- public void CatchClientSideEvaluationException_CCEEInner_ExecutesEvaluator ( )
104+ public async Task CatchClientSideEvaluationException_CCEEInner_ExecutesEvaluator ( )
104105 {
105106 bool isExecuted = false ;
106107 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
107108 ApplicationException exception = new ( "Original exception" , new NotSupportedException ( "foo" ) ) ;
108- Action act = ( ) => controller . CatchClientSideEvaluationException ( exception , "foo" , ( ) => isExecuted = true ) ;
109- act . Should ( ) . NotThrow ( ) ;
109+
110+ Func < Task > act = async ( ) => await controller . CatchClientSideEvaluationExceptionAsync ( exception , "foo" , ( ) => { isExecuted = true ; return Task . CompletedTask ; } ) ;
111+ await act . Should ( ) . NotThrowAsync ( ) ;
110112 isExecuted . Should ( ) . BeTrue ( ) ;
111113 }
112114 #endregion
113115
114116 #region ExecuteQueryWithClientEvaluation
115117 [ Fact ]
116- public void ExecuteQueryWithClientEvaluation_ExecutesServiceSide ( )
118+ public async Task ExecuteQueryWithClientEvaluation_ExecutesServiceSide ( )
117119 {
118120 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
119121 controller . Options . DisableClientSideEvaluation = true ;
120122
121123 int evaluations = 0 ;
122- void evaluator ( IQueryable < InMemoryMovie > dataset )
124+ Task evaluator ( IQueryable < InMemoryMovie > dataset )
123125 {
124126 evaluations ++ ;
125127 // if (evaluations == 1) throw new NotSupportedException("Server side");
126128 // if (evaluations == 2) throw new NotSupportedException("Client side");
129+ return Task . CompletedTask ;
127130 }
128131
129132 List < InMemoryMovie > dataset = [ ] ;
130133
131- Action act = ( ) => controller . ExecuteQueryWithClientEvaluation ( dataset . AsQueryable ( ) , evaluator ) ;
134+ Func < Task > act = async ( ) => await controller . ExecuteQueryWithClientEvaluationAsync ( dataset . AsQueryable ( ) , evaluator ) ;
132135
133- act . Should ( ) . NotThrow ( ) ;
136+ await act . Should ( ) . NotThrowAsync ( ) ;
134137 evaluations . Should ( ) . Be ( 1 ) ;
135138 }
136139
137140 [ Fact ]
138- public void ExecuteQueryWithClientEvaluation_ThrowsServiceSide_WhenClientEvaluationDisabled ( )
141+ public async Task ExecuteQueryWithClientEvaluation_ThrowsServiceSide_WhenClientEvaluationDisabled ( )
139142 {
140143 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
141144 controller . Options . DisableClientSideEvaluation = true ;
142145
143146 int evaluations = 0 ;
144147#pragma warning disable IDE0011 // Add braces
145- void evaluator ( IQueryable < InMemoryMovie > dataset )
148+ Task evaluator ( IQueryable < InMemoryMovie > dataset )
146149 {
147150 evaluations ++ ;
148151 if ( evaluations == 1 ) throw new NotSupportedException ( "Server side" ) ;
149152 if ( evaluations == 2 ) throw new NotSupportedException ( "Client side" ) ;
153+ return Task . CompletedTask ;
150154 }
151155#pragma warning restore IDE0011 // Add braces
152156
153157 List < InMemoryMovie > dataset = [ ] ;
154158
155- Action act = ( ) => controller . ExecuteQueryWithClientEvaluation ( dataset . AsQueryable ( ) , evaluator ) ;
159+ Func < Task > act = async ( ) => await controller . ExecuteQueryWithClientEvaluationAsync ( dataset . AsQueryable ( ) , evaluator ) ;
156160
157- act . Should ( ) . Throw < NotSupportedException > ( ) . WithMessage ( "Server side" ) ;
161+ ( await act . Should ( ) . ThrowAsync < NotSupportedException > ( ) ) . WithMessage ( "Server side" ) ;
158162 }
159163
160164 [ Fact ]
161- public void ExecuteQueryWithClientEvaluation_ExecutesClientSide_WhenClientEvaluationEnabled ( )
165+ public async Task ExecuteQueryWithClientEvaluation_ExecutesClientSide_WhenClientEvaluationEnabled ( )
162166 {
163167 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
164168 controller . Options . DisableClientSideEvaluation = false ;
165169
166170 int evaluations = 0 ;
167171#pragma warning disable IDE0011 // Add braces
168- void evaluator ( IQueryable < InMemoryMovie > dataset )
172+ Task evaluator ( IQueryable < InMemoryMovie > dataset )
169173 {
170174 evaluations ++ ;
171175 if ( evaluations == 1 ) throw new NotSupportedException ( "Server side" ) ;
172176 //if (evaluations == 2) throw new NotSupportedException("Client side");
177+ return Task . CompletedTask ;
173178 }
174179#pragma warning restore IDE0011 // Add braces
175180
176181 List < InMemoryMovie > dataset = [ ] ;
177182
178- Action act = ( ) => controller . ExecuteQueryWithClientEvaluation ( dataset . AsQueryable ( ) , evaluator ) ;
183+ Func < Task > act = async ( ) => await controller . ExecuteQueryWithClientEvaluationAsync ( dataset . AsQueryable ( ) , evaluator ) ;
179184
180- act . Should ( ) . NotThrow ( ) ;
185+ await act . Should ( ) . NotThrowAsync ( ) ;
181186 evaluations . Should ( ) . Be ( 2 ) ;
182187 }
183188
184189 [ Fact ]
185- public void ExecuteQueryWithClientEvaluation_ThrowsClientSide_WhenClientEvaluationEnabled ( )
190+ public async Task ExecuteQueryWithClientEvaluation_ThrowsClientSide_WhenClientEvaluationEnabled ( )
186191 {
187192 TableController < InMemoryMovie > controller = new ( ) { Repository = new InMemoryRepository < InMemoryMovie > ( ) } ;
188193 controller . Options . DisableClientSideEvaluation = false ;
189194
190195 int evaluations = 0 ;
191196#pragma warning disable IDE0011 // Add braces
192- void evaluator ( IQueryable < InMemoryMovie > dataset )
197+ Task evaluator ( IQueryable < InMemoryMovie > dataset )
193198 {
194199 evaluations ++ ;
195200 if ( evaluations == 1 ) throw new NotSupportedException ( "Server side" , new ApplicationException ( "Inner exception" ) ) ;
196201 if ( evaluations == 2 ) throw new NotSupportedException ( "Client side" ) ;
202+ return Task . CompletedTask ;
197203 }
198204#pragma warning restore IDE0011 // Add braces
199205
200206 List < InMemoryMovie > dataset = [ ] ;
201207
202- Action act = ( ) => controller . ExecuteQueryWithClientEvaluation ( dataset . AsQueryable ( ) , evaluator ) ;
208+ Func < Task > act = async ( ) => await controller . ExecuteQueryWithClientEvaluationAsync ( dataset . AsQueryable ( ) , evaluator ) ;
203209
204- act . Should ( ) . Throw < NotSupportedException > ( ) . WithMessage ( "Client side" ) ;
210+ ( await act . Should ( ) . ThrowAsync < NotSupportedException > ( ) ) . WithMessage ( "Client side" ) ;
205211 evaluations . Should ( ) . Be ( 2 ) ;
206212 }
207213 #endregion
0 commit comments