@@ -27,16 +27,16 @@ public async Task TestSimpleParameterlessRequirementHandlingSucceeds()
2727
2828 var command = new TestableCommands . Command1 ( ) ;
2929
30- await mediator . CommandAsync < TestableCommands . Command1 , bool > ( command ) ;
30+ await mediator . Send ( command ) ;
3131
32- Assert . AreEqual ( 2 , testableContainer . Count ) ;
32+ Assert . HasCount ( 2 , testableContainer ) ;
3333 // Auth handler is executed first
3434 Assert . AreEqual (
3535 typeof ( TestableAuthorizationRequirementHandlers . Requirement2Handler < TestableCommands . Command1 > ) . FullName ,
3636 testableContainer . Dequeue ( ) ) ;
3737 // Command handler is executed last
3838 Assert . AreEqual (
39- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command1 > ) . FullName ,
39+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
4040 testableContainer . Dequeue ( ) ) ;
4141 }
4242 }
@@ -52,16 +52,16 @@ public async Task TestRequirementHandlingSucceedsWhenHandlerDependsOnCommand()
5252
5353 var command2 = new TestableCommands . Command2 ( ) ;
5454
55- await mediator . CommandAsync < TestableCommands . Command2 , bool > ( command2 ) ;
55+ await mediator . Send ( command2 ) ;
5656
57- Assert . AreEqual ( 2 , testableContainer . Count ) ;
57+ Assert . HasCount ( 2 , testableContainer ) ;
5858 // Appropriate (based on the command interface) auth handler is executed first
5959 Assert . AreEqual (
6060 typeof ( TestableAuthorizationRequirementHandlers . Requirement2ViaSomething1Handler < TestableCommands . Command2 > ) . FullName ,
6161 testableContainer . Dequeue ( ) ) ;
6262 // Command handler is executed last
6363 Assert . AreEqual (
64- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command2 > ) . FullName ,
64+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
6565 testableContainer . Dequeue ( ) ) ;
6666 }
6767
@@ -73,16 +73,16 @@ public async Task TestRequirementHandlingSucceedsWhenHandlerDependsOnCommand()
7373
7474 var command3 = new TestableCommands . Command3 ( ) ;
7575
76- await mediator . CommandAsync < TestableCommands . Command3 , bool > ( command3 ) ;
76+ await mediator . Send ( command3 ) ;
7777
78- Assert . AreEqual ( 2 , testableContainer . Count ) ;
78+ Assert . HasCount ( 2 , testableContainer ) ;
7979 // Appropriate (based on the command interface) auth handler is executed first
8080 Assert . AreEqual (
8181 typeof ( TestableAuthorizationRequirementHandlers . Requirement2ViaSomething2Handler < TestableCommands . Command3 > ) . FullName ,
8282 testableContainer . Dequeue ( ) ) ;
8383 // Command handler is executed last
8484 Assert . AreEqual (
85- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command3 > ) . FullName ,
85+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
8686 testableContainer . Dequeue ( ) ) ;
8787 }
8888 }
@@ -98,9 +98,9 @@ public async Task TestPolicyRequirementsAreHandledByOrLogicAndPolicySucceedsEven
9898
9999 var command4 = new TestableCommands . Command4 ( ) ;
100100
101- await mediator . CommandAsync < TestableCommands . Command4 , bool > ( command4 ) ;
101+ await mediator . Send ( command4 ) ;
102102
103- Assert . AreEqual ( 3 , testableContainer . Count ) ;
103+ Assert . HasCount ( 3 , testableContainer ) ;
104104 // First requirement handler is executed and fails
105105 Assert . AreEqual (
106106 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement1Handler < TestableCommands . Command4 > ) . FullName } : { new TestableAuthorizationRequirements . Requirement1 ( true , 42 , "Forty two" ) } - Failure",
@@ -111,7 +111,7 @@ public async Task TestPolicyRequirementsAreHandledByOrLogicAndPolicySucceedsEven
111111 testableContainer . Dequeue ( ) ) ;
112112 // Command handler is executed last
113113 Assert . AreEqual (
114- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command4 > ) . FullName ,
114+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
115115 testableContainer . Dequeue ( ) ) ;
116116 }
117117 }
@@ -127,17 +127,17 @@ public async Task TestPolicyRequirementsAreHandlerByOrLogicAndSecondRequirementN
127127
128128 var command5 = new TestableCommands . Command5 ( ) ;
129129
130- await mediator . CommandAsync < TestableCommands . Command5 , bool > ( command5 ) ;
130+ await mediator . Send ( command5 ) ;
131131
132- Assert . AreEqual ( 2 , testableContainer . Count ) ;
132+ Assert . HasCount ( 2 , testableContainer ) ;
133133 // First requirement handler is executed and succeeds
134134 Assert . AreEqual (
135135 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement2Handler < TestableCommands . Command5 > ) . FullName } ",
136136 testableContainer . Dequeue ( ) ) ;
137137 // Second requirement handler is not executed
138138 // Command handler is executed last
139139 Assert . AreEqual (
140- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command5 > ) . FullName ,
140+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
141141 testableContainer . Dequeue ( ) ) ;
142142 }
143143 }
@@ -155,12 +155,12 @@ public async Task TestPolicyRequirementsAreHandledByOrLogicAndPolicyFailsWhenBot
155155
156156 try
157157 {
158- await mediator . CommandAsync < TestableCommands . Command9 , bool > ( command9 ) ;
158+ await mediator . Send ( command9 ) ;
159159 Assert . Fail ( ) ;
160160 }
161161 catch ( AuthorizationPolicyFailedException )
162162 {
163- Assert . AreEqual ( 2 , testableContainer . Count ) ;
163+ Assert . HasCount ( 2 , testableContainer ) ;
164164 // First requirement handler is executed and fails
165165 Assert . AreEqual (
166166 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement1Handler < TestableCommands . Command9 > ) . FullName } : { new TestableAuthorizationRequirements . Requirement1 ( true , 41 , "Forty one" ) } - Failure",
@@ -185,9 +185,9 @@ public async Task TestPoliciesAreHandledByAndLogicAndEntireCheckSucceedsWhenBoth
185185
186186 var command6 = new TestableCommands . Command6 ( ) ;
187187
188- await mediator . CommandAsync < TestableCommands . Command6 , bool > ( command6 ) ;
188+ await mediator . Send ( command6 ) ;
189189
190- Assert . AreEqual ( 3 , testableContainer . Count ) ;
190+ Assert . HasCount ( 3 , testableContainer ) ;
191191 // First requirement handler is executed and succeeds
192192 Assert . AreEqual (
193193 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement2Handler < TestableCommands . Command6 > ) . FullName } ",
@@ -198,7 +198,7 @@ public async Task TestPoliciesAreHandledByAndLogicAndEntireCheckSucceedsWhenBoth
198198 testableContainer . Dequeue ( ) ) ;
199199 // Command handler is executed last
200200 Assert . AreEqual (
201- typeof ( TestableCommandHandlers . GenericCommandHandler < TestableCommands . Command6 > ) . FullName ,
201+ typeof ( TestableCommandHandlers . GenericCommandHandler < IRequest < bool > > ) . FullName ,
202202 testableContainer . Dequeue ( ) ) ;
203203 }
204204 }
@@ -216,12 +216,12 @@ public async Task TestPoliciesAreHandledByAndLogicAndEntireCheckFailsWhenFirstPo
216216
217217 try
218218 {
219- await mediator . CommandAsync < TestableCommands . Command7 , bool > ( command7 ) ;
219+ await mediator . Send ( command7 ) ;
220220 Assert . Fail ( ) ;
221221 }
222222 catch ( AuthorizationPolicyFailedException )
223223 {
224- Assert . AreEqual ( 1 , testableContainer . Count ) ;
224+ Assert . HasCount ( 1 , testableContainer ) ;
225225 // First requirement handler is executed and fails
226226 Assert . AreEqual (
227227 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement3Handler < TestableCommands . Command7 > ) . FullName } : { new TestableAuthorizationRequirements . Requirement3 ( true ) } - Failure",
@@ -245,12 +245,12 @@ public async Task TestPoliciesAreHandledByAndLogicAndEntireCheckFailsWhenFirstPo
245245
246246 try
247247 {
248- await mediator . CommandAsync < TestableCommands . Command8 , bool > ( command8 ) ;
248+ await mediator . Send ( command8 ) ;
249249 Assert . Fail ( ) ;
250250 }
251251 catch ( AuthorizationPolicyFailedException )
252252 {
253- Assert . AreEqual ( 2 , testableContainer . Count ) ;
253+ Assert . HasCount ( 2 , testableContainer ) ;
254254 // First requirement handler is executed and succeeds
255255 Assert . AreEqual (
256256 $ "{ typeof ( TestableAuthorizationRequirementHandlers . Requirement1Handler < TestableCommands . Command8 > ) . FullName } : { new TestableAuthorizationRequirements . Requirement1 ( false , 45 , "Forty five" ) } - Success",
@@ -276,7 +276,7 @@ public async Task TestRequestsWithoutPolicyAssignedToThemFail()
276276
277277 try
278278 {
279- await mediator . CommandAsync < TestableCommands . Command10 , bool > ( command10 ) ;
279+ await mediator . Send ( command10 ) ;
280280 }
281281 catch ( AuthorizationPolicyMissingException exception )
282282 {
@@ -304,7 +304,7 @@ protected override void ConfigureTestServices(
304304
305305 containerBuilder . RegisterGeneric ( typeof ( TestableCommandHandlers . GenericCommandHandler < > ) )
306306 . AsImplementedInterfaces ( )
307- . InstancePerLifetimeScope ( ) ;
307+ . InstancePerLifetimeScope ( ) ;
308308
309309 containerBuilder . AddAuthorizationRequirementHandlers (
310310 new SharedKernel . Authorization . AuthorizationOptions
0 commit comments