public void GivenOwnBankAccount_WhenDeriving_ThenBankAccountMustBeValidated() { var netherlands = new Countries(this.Session).CountryByIsoCode["NL"]; var euro = netherlands.Currency; var builder = new BankAccountBuilder(this.Session).WithCurrency(euro).WithIban("NL50RABO0109546784").WithNameOnAccount("Martien"); var bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session) .WithDescription("own account") .WithBankAccount(bankAccount).Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); var bank = new BankBuilder(this.Session).WithCountry(netherlands).WithName("RABOBANK GROEP").WithBic("RABONL2U").Build(); builder.WithBank(bank); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session) .WithDescription("own account") .WithBankAccount(bankAccount).Build(); Assert.False(this.Session.Derive(false).HasErrors); }
public void GivenBankAccount_WhenDeriving_ThenRequiredRelationsMustExist() { var builder = new BankAccountBuilder(this.DatabaseSession); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithIban("NL50RABO0109546784"); builder.Build(); Assert.IsFalse(this.DatabaseSession.Derive().HasErrors); }
public void GivenBankAccount_WhenDeriving_ThenRequiredRelationsMustExist() { var builder = new BankAccountBuilder(this.Session); builder.Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); builder.WithIban("NL50RABO0109546784"); builder.Build(); Assert.False(this.Session.Derive(false).HasErrors); }
public void GivenBankAccount_WhenOwnBankAccount_ThenRequiredRelationsMustExist() { 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(); this.Session.Commit(); var builder = new BankAccountBuilder(this.Session).WithIban("NL50RABO0109546784"); var bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session).WithBankAccount(bankAccount).Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); builder.WithBank(bank); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session).WithBankAccount(bankAccount).Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); builder.WithCurrency(euro); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session).WithBankAccount(bankAccount).Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); builder.WithNameOnAccount("name"); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.Session).WithBankAccount(bankAccount).WithDescription("description").Build(); Assert.False(this.Session.Derive(false).HasErrors); }
public void GivenBankAccount_WhenOwnBankAccount_ThenRequiredRelationsMustExist() { var netherlands = new Countries(this.DatabaseSession).CountryByIsoCode["NL"]; var euro = netherlands.Currency; var bank = new BankBuilder(this.DatabaseSession).WithCountry(netherlands).WithName("RABOBANK GROEP").WithBic("RABONL2U").Build(); this.DatabaseSession.Commit(); var builder = new BankAccountBuilder(this.DatabaseSession).WithIban("NL50RABO0109546784"); var bankAccount = builder.Build(); new OwnBankAccountBuilder(this.DatabaseSession).WithBankAccount(bankAccount).Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithBank(bank); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.DatabaseSession).WithBankAccount(bankAccount).Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithCurrency(euro); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.DatabaseSession).WithBankAccount(bankAccount).Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithNameOnAccount("name"); bankAccount = builder.Build(); new OwnBankAccountBuilder(this.DatabaseSession).WithBankAccount(bankAccount).WithDescription("description").Build(); Assert.IsFalse(this.DatabaseSession.Derive().HasErrors); }