Exemple #1
0
        public static SurchargeAdjustmentBuilder WithPercentageDefaults(this SurchargeAdjustmentBuilder @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 GivenSurchargeAdjustment_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var builder = new SurchargeAdjustmentBuilder(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);
        }
Exemple #3
0
        public void GivenSurchargeAdjustment_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var builder = new SurchargeAdjustmentBuilder(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);
        }