Пример #1
0
        public Task entry_not_in_balance_throws(GeneralLedgerEntryIdentifier generalLedgerEntryIdentifier,
                                                int sequenceNumber, LocalDate openedOn, AccountName accountName, AccountNumber accountNumber)
        {
            var scenario = new Scenario()
                           .Given(GeneralLedger.Identifier,
                                  new GeneralLedgerOpened {
                OpenedOn = Time.Format.LocalDate(openedOn)
            })
                           .Given(ChartOfAccounts.Identifier,
                                  new AccountDefined {
                AccountName   = accountName.ToString(),
                AccountNumber = accountNumber.ToInt32()
            })
                           .When(new PostGeneralLedgerEntry {
                Period = AccountingPeriod.Open(openedOn).ToString(),
                BusinessTransaction = new BadTransaction {
                    Account         = accountNumber,
                    ReferenceNumber = sequenceNumber
                },
                CreatedOn            = openedOn.ToDateTimeUnspecified(),
                GeneralLedgerEntryId = generalLedgerEntryIdentifier.ToGuid()
            })
                           .Throws(new GeneralLedgerEntryNotInBalanceException(generalLedgerEntryIdentifier));

            _writer.Write(scenario.Build());
            return(scenario.Assert(new GeneralLedgerEntryHandlers(new GeneralLedgerTestRepository(_facts),
                                                                  new GeneralLedgerEntryTestRepository(_facts),
                                                                  _ => false), _facts));
        }
        public void WriteEventCentricTestSpecificationResultsInExpectedOutput(
            EventCentricTestSpecification specification, string result)
        {
            using (var writer = new StringWriter())
            {
                var sut = new TestSpecificationTextWriter(writer);

                sut.Write(specification);

                Assert.That(writer.ToString(), Is.EqualTo(result));
            }
        }