Exemple #1
0
        public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsNotNull()
        {
            IAccountCollection sut = CreateSut();

            sut.Add(CreateAccountCollection());

            IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync();

            Assert.That(result, Is.Not.Null);
        }
Exemple #2
0
        public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsAccountCollectionMatchingEachAccountGroupFromAccountsInAccountCollection()
        {
            IAccountCollection sut = CreateSut();

            sut.Add(CreateAccountCollection());

            IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync();

            Assert.That(result.All(item => item.Value.All(account => account.AccountGroup.Number == item.Key.Number)), Is.True);
        }
Exemple #3
0
        public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsAllAccountsInAccountCollection()
        {
            IAccountCollection sut = CreateSut();

            IAccount[] accountCollection = CreateAccountCollection();
            sut.Add(accountCollection);

            IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync();

            Assert.That(accountCollection.All(account => result.SelectMany(item => item.Value).Contains(account)), Is.True);
        }
Exemple #4
0
        public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsEachAccountGroupFromAccountsInAccountCollection()
        {
            IAccountCollection sut = CreateSut();

            IAccountGroup[] accountGroupCollection = _fixture.CreateMany <IAccountGroup>(_random.Next(2, 5)).ToArray();
            sut.Add(CreateAccountCollection(accountGroupCollection));

            IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync();

            Assert.That(accountGroupCollection.All(accountGroup => result.Keys.Single(key => key.Number == accountGroup.Number) != null), Is.True);
        }
Exemple #5
0
        public async Task GroupByAccountGroupAsync_WhenCalled_AssertAccountNumberWasCalledOnEachAccountInAccountCollection()
        {
            IAccountCollection sut = CreateSut();

            Mock <IAccount>[] accountMockCollection = CreateAccountMockCollection();
            sut.Add(accountMockCollection.Select(accountMock => accountMock.Object).ToArray());

            await sut.GroupByAccountGroupAsync();

            foreach (Mock <IAccount> accountMock in accountMockCollection)
            {
                accountMock.Verify(m => m.AccountNumber, Times.Once);
            }
        }
Exemple #6
0
        public async Task GroupByAccountGroupAsync_WhenCalled_AssertNumberWasCalledOnAccountGroupForEachAccountInAccountCollection()
        {
            IAccountCollection sut = CreateSut();

            Mock <IAccountGroup>[] accountGroupMockCollection =
            {
                _fixture.BuildAccountGroupMock(),
                _fixture.BuildAccountGroupMock(),
                _fixture.BuildAccountGroupMock()
            };
            sut.Add(CreateAccountCollection(accountGroupMockCollection.Select(accountGroupMock => accountGroupMock.Object).ToArray()));

            await sut.GroupByAccountGroupAsync();

            foreach (Mock <IAccountGroup> accountGroupMock in accountGroupMockCollection)
            {
                accountGroupMock.Verify(m => m.Number, Times.AtLeastOnce);
            }
        }