Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }