File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
exercises/practice/bank-account Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class {{ testClass }}
2828{
2929 {{- for test in tests } }
3030 [Fact{ { if ! for.first } }(Skip = "Remove this Skip property to run this test"){ { end } }]
31- public void { { test.testMethod } }()
31+ public { { if test.scenarios | array.contains " concurrent " } }async Task { { else } } void{ { end } } { { test.testMethod } }()
3232 {
3333 var account = new {{ testedClass } }();
3434 { {- for op in test.input.operations } }
@@ -51,7 +51,7 @@ public class {{ testClass }}
5151 { {- end -} }
5252 }
5353 }));
54- Task.WaitAll(tasks.ToArray());
54+ await Task.WaitAll(tasks.ToArray());
5555 }
5656 { {- else } }
5757 account.{ { op | to_call } };
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ public void Cannot_deposit_negative()
153153 }
154154
155155 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
156- public void Can_handle_concurrent_transactions ( )
156+ public async Task Can_handle_concurrent_transactions ( )
157157 {
158158 var account = new BankAccount ( ) ;
159159 account . Open ( ) ;
@@ -168,7 +168,7 @@ public void Can_handle_concurrent_transactions()
168168 account . Withdraw ( 1m ) ;
169169 }
170170 } ) ) ;
171- Task . WaitAll ( tasks . ToArray ( ) ) ;
171+ await Task . WaitAll ( tasks . ToArray ( ) ) ;
172172 }
173173 Assert . Equal ( 0m , account . Balance ) ;
174174 }
You can’t perform that action at this time.
0 commit comments