예제 #1
0
        public void ToInt32ReturnsExpectedResult(int value)
        {
            var expected = Math.Max(1000, value % 8999);
            var sut      = new AccountNumber(expected);

            Assert.Equal(expected, sut.ToInt32());
        }
예제 #2
0
        public void RenameAccount(AccountNumber accountNumber, AccountName newAccountName)
        {
            MustContainAccountNumber(accountNumber);

            Apply(new AccountRenamed {
                AccountNumber  = accountNumber.ToInt32(),
                NewAccountName = newAccountName.ToString()
            });
        }
예제 #3
0
        public void DefineAccount(AccountName accountName, AccountNumber accountNumber)
        {
            MustNotContainAccountNumber(accountNumber);

            Apply(new AccountDefined {
                AccountName   = accountName.ToString(),
                AccountNumber = accountNumber.ToInt32()
            });
        }
예제 #4
0
        public void ReactivateAccount(AccountNumber accountNumber)
        {
            MustContainAccountNumber(accountNumber);

            if (IsActive(accountNumber))
            {
                return;
            }

            Apply(new AccountReactivated {
                AccountNumber = accountNumber.ToInt32()
            });
        }
예제 #5
0
        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()
            });
        }
예제 #6
0
        public void Equality(AccountNumber sut)
        {
            var copy = new AccountNumber(sut.ToInt32());

            Assert.Equal(sut, copy);
        }
예제 #7
0
        public void EqualityOperator(AccountNumber sut)
        {
            var copy = new AccountNumber(sut.ToInt32());

            Assert.True(sut == copy);
        }