public static ShippingAndHandlingChargeBuilder WithPercentageDefaults(this ShippingAndHandlingChargeBuilder @this) { var faker = @this.Session.Faker(); @this.WithPercentage(decimal.Round(faker.Random.Decimal(1, 5), 2)); @this.WithDescription(faker.Lorem.Sentence()); return(@this); }
public void GivenShippingAndHandlingCharge_WhenDeriving_ThenRequiredRelationsMustExist() { var builder = new ShippingAndHandlingChargeBuilder(this.DatabaseSession); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithAmount(1); builder.Build(); Assert.IsFalse(this.DatabaseSession.Derive().HasErrors); builder.WithPercentage(1); builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); }
public void GivenShippingAndHandlingCharge_WhenDeriving_ThenRequiredRelationsMustExist() { var builder = new ShippingAndHandlingChargeBuilder(this.Session); builder.Build(); Assert.True(this.Session.Derive(false).HasErrors); this.Session.Rollback(); builder.WithAmount(1); builder.Build(); Assert.False(this.Session.Derive(false).HasErrors); builder.WithPercentage(1); builder.Build(); Assert.True(this.Session.Derive(false).HasErrors); }