exercism / exercism/csharp

Bank Account (Unit Tests)

オープン
#2,406 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
427
フォーク
383
平均マージ
2日 2時間
マージ済み PR(30日)
5

説明

I am not sure if I am doing ti right, but the tests indicate that the cancellation token should be passed from a given source.

We received the following error when we ran your code:

BankAccountTests.cs(158,23): warning xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

I am sure the test case with the Tasks is the one with the issue, as indicated by the error message.

`csharp
[Fact(Skip = "Remove this Skip property to run this test")]
public async Task Can_handle_concurrent_transactions()
{
var account = new BankAccount();
account.Open();
for (int i = 0; i < 500; i++)
{
var tasks = new List();
tasks.Add(Task.Factory.StartNew(() =>
{
for (int j = 0; j < 100; j++)
{
account.Deposit(1m);
account.Withdraw(1m);
}
}));
await Task.WhenAll(tasks.ToArray());
}
Assert.Equal(0m, account.Balance);
}
`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。