public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsAccountCollectionValuesWhereLiabilitiesIsEqualToZero() { IAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IAccount>(_random.Next(5, 10)).ToArray()); IAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result.Liabilities, Is.EqualTo(0M)); }
public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsNotNull() { IAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IAccount>(_random.Next(5, 10)).ToArray()); IAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result, Is.Not.Null); }
protected override IAccountCollection Calculate(DateTime statusDate, IReadOnlyCollection <IAccount> calculatedAccountCollection) { NullGuard.NotNull(calculatedAccountCollection, nameof(calculatedAccountCollection)); IReadOnlyDictionary <AccountGroupType, IEnumerable <IAccount> > accountGroupDictionary = GroupByAccountGroupType(calculatedAccountCollection); IReadOnlyCollection <IAccount> assetAccountCollection = ResolveAssets(accountGroupDictionary); IReadOnlyCollection <IAccount> liabilityAccountCollection = ResolveLiabilities(accountGroupDictionary); ValuesAtStatusDate = ToAccountCollectionValues(assetAccountCollection, liabilityAccountCollection, account => account.ValuesAtStatusDate); ValuesAtEndOfLastMonthFromStatusDate = ToAccountCollectionValues(assetAccountCollection, liabilityAccountCollection, account => account.ValuesAtEndOfLastMonthFromStatusDate); ValuesAtEndOfLastYearFromStatusDate = ToAccountCollectionValues(assetAccountCollection, liabilityAccountCollection, account => account.ValuesAtEndOfLastYearFromStatusDate); return(this); }