Пример #1
0
        public async Task CalculateAsync_WhenCalled_ReturnsSameAccount()
        {
            IAccount sut = CreateSut();

            IAccount result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1));

            Assert.That(result, Is.SameAs(sut));
        }
Пример #2
0
        public async Task CalculateAsync_WhenCalled_AssertApplyCalculationAsyncWasCalledOnPostingLineCollection()
        {
            Mock <IPostingLineCollection> postingLineCollectionMock = _fixture.BuildPostingLineCollectionMock();
            IAccount sut = CreateSut(postingLineCollection: postingLineCollectionMock.Object);

            await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1));

            postingLineCollectionMock.Verify(m => m.ApplyCalculationAsync(It.Is <IAccount>(value => value != null && value == sut)), Times.Once);
        }
Пример #3
0
        public async Task CalculateAsync_WhenCalled_ReturnsSameAccountWherePostingLineCollectionIsEqualToCalculatedPostingLineCollection()
        {
            IPostingLineCollection calculatedPostingLineCollection = _fixture.BuildPostingLineCollectionMock().Object;
            IPostingLineCollection postingLineCollection           = _fixture.BuildPostingLineCollectionMock(calculatedPostingLineCollection: calculatedPostingLineCollection).Object;
            IAccount sut = CreateSut(postingLineCollection: postingLineCollection);

            IAccount result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1));

            Assert.That(result.PostingLineCollection, Is.EqualTo(calculatedPostingLineCollection));
        }
Пример #4
0
        public async Task CalculateAsync_WhenCalled_AssertCalculateAsyncWasCalledOnPostingLineCollection()
        {
            Mock <IPostingLineCollection> postingLineCollectionMock = _fixture.BuildPostingLineCollectionMock();
            IAccount 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);
        }