public void ToInt32ReturnsExpectedResult(int value) { var expected = Math.Max(1000, value % 8999); var sut = new AccountNumber(expected); Assert.Equal(expected, sut.ToInt32()); }
public void RenameAccount(AccountNumber accountNumber, AccountName newAccountName) { MustContainAccountNumber(accountNumber); Apply(new AccountRenamed { AccountNumber = accountNumber.ToInt32(), NewAccountName = newAccountName.ToString() }); }
public void DefineAccount(AccountName accountName, AccountNumber accountNumber) { MustNotContainAccountNumber(accountNumber); Apply(new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }); }
public void ReactivateAccount(AccountNumber accountNumber) { MustContainAccountNumber(accountNumber); if (IsActive(accountNumber)) { return; } Apply(new AccountReactivated { AccountNumber = accountNumber.ToInt32() }); }
public void BeginClosingPeriod(AccountNumber retainedEarningsAccountNumber, GeneralLedgerEntryIdentifier closingGeneralLedgerEntryIdentifier, GeneralLedgerEntryIdentifier[] generalLedgerEntryIdentifiers, DateTimeOffset closingOn) { if (_periodClosing) { throw new PeriodClosingInProcessException(_period); } _period.MustNotBeAfter(closingOn); Apply(new AccountingPeriodClosing { Period = _period.ToString(), GeneralLedgerEntryIds = Array.ConvertAll(generalLedgerEntryIdentifiers, id => id.ToGuid()), ClosingOn = closingOn, RetainedEarningsAccountNumber = retainedEarningsAccountNumber.ToInt32(), ClosingGeneralLedgerEntryId = closingGeneralLedgerEntryIdentifier.ToGuid() }); }
public void Equality(AccountNumber sut) { var copy = new AccountNumber(sut.ToInt32()); Assert.Equal(sut, copy); }
public void EqualityOperator(AccountNumber sut) { var copy = new AccountNumber(sut.ToInt32()); Assert.True(sut == copy); }