public async Task FindDebtorsAsync_WhenContactAccountCollectionContainsDebtorContactAccounts_ReturnsAccountCollectionWithDebtorContactAccountsFromContactAccountCollection()
        {
            IContactAccountCollection sut = CreateSut();

            IEnumerable <IContactAccount> debtorContactAccountCollection = new List <IContactAccount>
            {
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Debtor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Debtor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Debtor).Object
            };

            sut.Add(debtorContactAccountCollection);

            IEnumerable <IContactAccount> nonDebtorContactAccountCollection = new List <IContactAccount>
            {
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object
            };

            sut.Add(nonDebtorContactAccountCollection);

            IContactAccountCollection result = await sut.FindDebtorsAsync();

            Assert.That(result.Count(), Is.EqualTo(debtorContactAccountCollection.Count()));
            Assert.That(result.All(contactAccount => debtorContactAccountCollection.Contains(contactAccount)), Is.True);
        }
        public async Task GetContactAccountsAsync_WhenAccountingNumberDoesNotExist_ReturnsEmptyContactAccountCollection()
        {
            IAccountingRepository sut = CreateSut();

            IContactAccountCollection result = await sut.GetContactAccountsAsync(WithNonExistingAccountingNumber(), DateTime.Today);

            Assert.That(result.Count(), Is.EqualTo(0));
        }
        public async Task QueryAsync_WhenNoContactAccountCollectionWasReturnedFromAccountingRepository_ReturnsEmptyContactAccountCollection()
        {
            QueryHandler sut = CreateSut(false);

            IGetDebtorAccountCollectionQuery query  = CreateQuery();
            IContactAccountCollection        result = await sut.QueryAsync(query);

            Assert.That(result.Count(), Is.EqualTo(0));
        }
        public async Task FindDebtorsAsync_WhenContactAccountCollectionContainsOnlyNonDebtorContactAccounts_ReturnsEmptyAccountCollection()
        {
            IContactAccountCollection sut = CreateSut();

            IEnumerable <IContactAccount> nonDebtorContactAccountCollection = new List <IContactAccount>
            {
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.None).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object,
                _fixture.BuildContactAccountMock(contactAccountType: ContactAccountType.Creditor).Object
            };

            sut.Add(nonDebtorContactAccountCollection);

            IContactAccountCollection result = await sut.FindDebtorsAsync();

            Assert.That(result.Count(), Is.EqualTo(0));
        }