public async Task CalculateAsync_WhenCalled_ReturnsSameBudgetAccount() { IBudgetAccount sut = CreateSut(); IBudgetAccount result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result, Is.SameAs(sut)); }
public async Task CalculateAsync_WhenCalled_AssertApplyCalculationAsyncWasCalledOnPostingLineCollection() { Mock <IPostingLineCollection> postingLineCollectionMock = _fixture.BuildPostingLineCollectionMock(); IBudgetAccount sut = CreateSut(postingLineCollection: postingLineCollectionMock.Object); await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); postingLineCollectionMock.Verify(m => m.ApplyCalculationAsync(It.Is <IBudgetAccount>(value => value != null && value == sut)), Times.Once); }
public async Task CalculateAsync_WhenCalled_ReturnsSameBudgetAccountWherePostingLineCollectionIsEqualToCalculatedPostingLineCollection() { IPostingLineCollection calculatedPostingLineCollection = _fixture.BuildPostingLineCollectionMock().Object; IPostingLineCollection postingLineCollection = _fixture.BuildPostingLineCollectionMock(calculatedPostingLineCollection: calculatedPostingLineCollection).Object; IBudgetAccount sut = CreateSut(postingLineCollection: postingLineCollection); IBudgetAccount result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result.PostingLineCollection, Is.EqualTo(calculatedPostingLineCollection)); }
public async Task CalculateAsync_WhenCalled_AssertCalculateAsyncWasCalledOnPostingLineCollection() { Mock <IPostingLineCollection> postingLineCollectionMock = _fixture.BuildPostingLineCollectionMock(); IBudgetAccount sut = CreateSut(postingLineCollection: postingLineCollectionMock.Object); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); await sut.CalculateAsync(statusDate); postingLineCollectionMock.Verify(m => m.CalculateAsync(It.Is <DateTime>(value => value == statusDate.Date)), Times.Once); }