public void GivenCountryWhenValidatingThenRequiredRelationsMustExist() { var builder = new CountryBuilder(this.DatabaseSession); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); builder.WithIsoCode("XX").Build(); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithName("X Country"); builder.Build(); Assert.IsFalse(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder = new CountryBuilder(this.DatabaseSession); builder.WithName("X Country"); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); }
public void GivenCountryWhenValidatingThenRequiredRelationsMustExist() { var builder = new CountryBuilder(this.Session); builder.Build(); Assert.IsTrue(this.Session.Derive().HasErrors); builder.WithIsoCode("XX").Build(); builder.Build(); Assert.IsTrue(this.Session.Derive().HasErrors); this.Session.Rollback(); builder.WithName("X Country"); builder.Build(); Assert.IsFalse(this.Session.Derive().HasErrors); this.Session.Rollback(); builder = new CountryBuilder(this.Session); builder.WithName("X Country"); builder.Build(); Assert.IsTrue(this.Session.Derive().HasErrors); }
public void TheBuilderPatternShouldReturnADefaultObjectIfNoValuesAreProvided() { var country = _builder.Build(); Assert.AreEqual("Default", country.Name); Assert.AreEqual("Default", country.Continent.Name); Assert.AreEqual("Default", country.Currency); Assert.AreEqual("Default", country.Language); }