示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
            }
        }
示例#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);
            }
        }