public void GivenOwnBankAccountForSingletonThatDoesAccounting_WhenDeriving_ThenEitherGeneralLedgerAccountOrJournalMustExist() { var internalOrganisation = this.InternalOrganisation; var generalLedgerAccount = new GeneralLedgerAccountBuilder(this.Session) .WithAccountNumber("0001") .WithName("GeneralLedgerAccount") .WithBalanceSheetAccount(true) .Build(); var internalOrganisationGlAccount = new OrganisationGlAccountBuilder(this.Session) .WithGeneralLedgerAccount(generalLedgerAccount) .Build(); var journal = new JournalBuilder(this.Session).WithDescription("journal").Build(); var netherlands = new Countries(this.Session).CountryByIsoCode["NL"]; var euro = netherlands.Currency; var bank = new BankBuilder(this.Session).WithCountry(netherlands).WithName("RABOBANK GROEP").WithBic("RABONL2U").Build(); var bankAccount = new BankAccountBuilder(this.Session).WithBank(bank).WithCurrency(euro).WithIban("NL50RABO0109546784").WithNameOnAccount("Martien").Build(); var collectionMethod = new OwnBankAccountBuilder(this.Session) .WithDescription("own account") .WithBankAccount(bankAccount) .Build(); this.Session.Commit(); internalOrganisation.DoAccounting = true; ((OrganisationDerivedRoles)internalOrganisation).AddActiveCollectionMethod(collectionMethod); Assert.True(this.Session.Derive(false).HasErrors); collectionMethod.Journal = journal; Assert.False(this.Session.Derive(false).HasErrors); collectionMethod.RemoveJournal(); collectionMethod.GeneralLedgerAccount = internalOrganisationGlAccount; Assert.False(this.Session.Derive(false).HasErrors); }