public async Task CalculateAsync_WhenCalled_AssertAlreadyCalculatedWasNotCalledOnSut() { IAccountBase <IAccountBase> sut = CreateSut(); Sut result = (Sut)await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result.AlreadyCalculatedWasCalled, Is.False); }
public async Task CalculateAsync_WhenCalled_ReturnsSameAccountBase() { IAccountBase <IAccountBase> sut = CreateSut(); IAccountBase result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result, Is.SameAs(sut)); }
public async Task CalculateAsync_WhenCalled_AssertGetCalculationResultAsyncWasCalledOnSut() { IAccountBase <IAccountBase> sut = CreateSut(); Sut result = (Sut)await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result.GetCalculationResultAsyncWasCalled, Is.True); }
public async Task CalculateAsync_WhenCalled_ReturnsSameAccountBaseWhereStatusDateEqualDateFromCall() { IAccountBase <IAccountBase> sut = CreateSut(); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); IAccountBase result = await sut.CalculateAsync(statusDate); Assert.That(result.StatusDate, Is.EqualTo(statusDate.Date)); }
public async Task CalculateAsync_WhenCalled_AssertAllCalculationTasksIsCompleted() { Task[] calculationTasks = CreateCalculationTasks(); IAccountBase <IAccountBase> sut = CreateSut(calculationTasks); await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(calculationTasks.All(calculationTask => calculationTask.IsCompleted), Is.True); }
public async Task CalculateAsync_WhenCalled_AssertGetCalculationTasksWasCalledWithSameStatusDate() { IAccountBase <IAccountBase> sut = CreateSut(); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); Sut result = (Sut)await sut.CalculateAsync(statusDate); Assert.That(result.GetCalculationTasksWasCalledWithStatusDate, Is.EqualTo(statusDate.Date)); }
public async Task CalculateAsync_WhenCalledMultipleTimesWithSameStatusDate_ReturnsSameAccountBase() { IAccountBase <IAccountBase> sut = CreateSut(); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); IAccountBase result = await((IAccountBase <IAccountBase>)await((IAccountBase <IAccountBase>) await sut.CalculateAsync(statusDate)).CalculateAsync(statusDate)).CalculateAsync(statusDate); Assert.That(result, Is.SameAs(sut)); }
public async Task CalculateAsync_WhenCalledMultipleTimesWithSameStatusDate_AssertAlreadyCalculatedWasCalledTwiceOnSut() { IAccountBase <IAccountBase> sut = CreateSut(); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); Sut result = (Sut)await((IAccountBase <IAccountBase>)await((IAccountBase <IAccountBase>) await sut.CalculateAsync(statusDate)).CalculateAsync(statusDate)).CalculateAsync(statusDate); Assert.That(result.AlreadyCalculatedWasCalledTimes, Is.EqualTo(2)); }