示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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));
        }
示例#5
0
        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);
        }
示例#6
0
        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));
        }
示例#7
0
        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));
        }
示例#8
0
        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));
        }