exercism / exercism/csharp

Bank Account (Unit Tests)

Abierto
#2,406 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C#
Estrellas
427
Forks
383
Merge medio
2 d 2 h
PR fusionados (30 d)
5

Descripción

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);
}
`

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.