public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsContactAccountCollectionValuesWhereCreditorsIsEqualToZero() { IContactAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IContactAccount>(_random.Next(5, 10)).ToArray()); IContactAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result.Creditors, Is.EqualTo(0M)); }
public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsNotNull() { IContactAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IContactAccount>(_random.Next(5, 10)).ToArray()); IContactAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result, Is.Not.Null); }
protected override IContactAccountCollection Calculate(DateTime statusDate, IReadOnlyCollection <IContactAccount> calculatedContactAccountCollection) { NullGuard.NotNull(calculatedContactAccountCollection, nameof(calculatedContactAccountCollection)); IReadOnlyDictionary <ContactAccountType, IEnumerable <IContactAccount> > contactAccountGroupDictionary = GroupByContactAccountType(calculatedContactAccountCollection); IReadOnlyCollection <IContactAccount> debtorAccountCollection = ResolveDebtors(contactAccountGroupDictionary); IReadOnlyCollection <IContactAccount> creditorAccountCollection = ResolveCreditors(contactAccountGroupDictionary); ValuesAtStatusDate = ToContactAccountCollectionValues(debtorAccountCollection, creditorAccountCollection, contactAccount => contactAccount.ValuesAtStatusDate); ValuesAtEndOfLastMonthFromStatusDate = ToContactAccountCollectionValues(debtorAccountCollection, creditorAccountCollection, contactAccount => contactAccount.ValuesAtEndOfLastMonthFromStatusDate); ValuesAtEndOfLastYearFromStatusDate = ToContactAccountCollectionValues(debtorAccountCollection, creditorAccountCollection, contactAccount => contactAccount.ValuesAtEndOfLastYearFromStatusDate); return(this); }