예제 #1
0
        public async Task QueryAsync_WhenNoContactAccountWasReturnedFromAccountingRepository_ReturnsNull()
        {
            QueryHandler sut = CreateSut(false);

            IGetContactAccountQuery query  = CreateQuery();
            IContactAccount         result = await sut.QueryAsync(query);

            Assert.That(result, Is.Null);
        }
예제 #2
0
        public async Task QueryAsync_WhenContactAccountWasReturnedFromAccountingRepository_ReturnsCalculatedContactAccount()
        {
            IContactAccount calculatedContactAccount = _fixture.BuildContactAccountMock().Object;
            IContactAccount contactAccount           = _fixture.BuildContactAccountMock(calculatedContactAccount: calculatedContactAccount).Object;
            QueryHandler    sut = CreateSut(contactAccount: contactAccount);

            IGetContactAccountQuery query  = CreateQuery();
            IContactAccount         result = await sut.QueryAsync(query);

            Assert.That(result, Is.EqualTo(calculatedContactAccount));
        }
예제 #3
0
        public async Task QueryAsync_WhenCalled_AssertGetContactAccountAsyncWasCalledOnAccountingRepository()
        {
            QueryHandler sut = CreateSut();

            int      accountingNumber     = _fixture.Create <int>();
            string   accountNumber        = _fixture.Create <string>().ToUpper();
            DateTime statusDate           = _fixture.Create <DateTime>().Date;
            IGetContactAccountQuery query = CreateQuery(accountingNumber, accountNumber, statusDate);
            await sut.QueryAsync(query);

            _accountingRepositoryMock.Verify(m => m.GetContactAccountAsync(
                                                 It.Is <int>(value => value == accountingNumber),
                                                 It.Is <string>(value => string.CompareOrdinal(value, accountNumber) == 0),
                                                 It.Is <DateTime>(value => value == statusDate)),
                                             Times.Once);
        }