예제 #1
0
        public void WhenSetBasicColumnValuesMoreThanOnceThenMergeColumn()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column(cm => cm.Length(50));
            mapper.Column(cm => cm.NotNullable(false));

            hbmDiscriminator.Item.Should().Be.Null();
            hbmDiscriminator.length.Should().Be("50");
            hbmDiscriminator.notnull.Should().Be(false);
        }
예제 #2
0
        public void SettingColumnPlainValuesOverridesFormula()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Formula("formula");
            mapper.Column("colName");
            hbmDiscriminator.formula.Should().Be.Null();
            hbmDiscriminator.column.Should().Be("colName");
        }
예제 #3
0
        public void SettingColumnOverridesFormula()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Formula("formula");
            mapper.Column(cm => cm.Unique(true));
            hbmDiscriminator.formula.Should().Be.Null();
            hbmDiscriminator.Item.Should().Be.OfType <HbmColumn>();
        }
예제 #4
0
        public void WhenSetFormulaWithNullThenDoNothing()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column("MyColumn");
            mapper.Formula(null);
            hbmDiscriminator.formula.Should().Be.Null();
            hbmDiscriminator.column.Should().Not.Be.Null();
        }
예제 #5
0
        public void WhenSetFormulaThenResetColumn()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column("MyColumn");
            mapper.Formula("SomeFormula");
            hbmDiscriminator.formula.Should().Be("SomeFormula");
            hbmDiscriminator.column.Should().Be.Null();
            hbmDiscriminator.Item.Should().Be.Null();
        }
예제 #6
0
        public void WhenSetColumnValuesThenAddColumnTag()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column(cm =>
            {
                cm.SqlType("VARCHAR(50)");
                cm.NotNullable(false);
            });
            hbmDiscriminator.Item.Should().Not.Be.Null();
            hbmDiscriminator.Columns.Should().Have.Count.EqualTo(1);
        }
예제 #7
0
        public void SettingFormulaOverridesColumnPlainValues()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column("colName");
            mapper.Length(10);
            mapper.Formula("formula");
            hbmDiscriminator.formula.Should().Be("formula");
            hbmDiscriminator.column.Should().Be(null);
            hbmDiscriminator.length.Should().Be(null);
            hbmDiscriminator.notnull.Should().Be(true);
            hbmDiscriminator.Item.Should().Be.Null();
        }
예제 #8
0
        public void WhenSetBasicColumnValuesThenSetPlainValues()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column(cm =>
            {
                cm.Length(50);
                cm.NotNullable(false);
            });
            hbmDiscriminator.Item.Should().Be.Null();
            hbmDiscriminator.length.Should().Be("50");
            hbmDiscriminator.notnull.Should().Be(false);
        }
예제 #9
0
        public void WhenSetColumnValuesThenDefaultNotNullableShouldBeTrue()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column(cm =>
            {
                cm.SqlType("VARCHAR(50)");
            });
            var hbmColumn = hbmDiscriminator.Columns.Single();

            hbmColumn.notnullSpecified.Should().Be.True();
            hbmColumn.notnull.Should().Be.True();
            hbmDiscriminator.notnull.Should().Be.True();
        }
예제 #10
0
        public void WhenSetColumnValuesThenOverrideDefaultNotNullable()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Column(cm =>
            {
                cm.SqlType("VARCHAR(50)");
                cm.NotNullable(false);
            });
            var hbmColumn = hbmDiscriminator.Columns.Single();

            hbmColumn.notnullSpecified.Should().Be.False();
            hbmColumn.notnull.Should().Be.False();
            hbmDiscriminator.notnull.Should("the not-null should be the default and should not be present in the mapping.").Be.True();
        }
 public void SettingColumnPlainValuesOverridesFormula()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Formula("formula");
     mapper.Column("colName");
     hbmDiscriminator.formula.Should().Be.Null();
     hbmDiscriminator.column.Should().Be("colName");
 }
        public void WhenSetBasicColumnValuesMoreThanOnceThenMergeColumn()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper = new DiscriminatorMapper(hbmDiscriminator);
            mapper.Column(cm => cm.Length(50));
            mapper.Column(cm => cm.NotNullable(true));

            hbmDiscriminator.Item.Should().Be.Null();
            hbmDiscriminator.length.Should().Be("50");
            hbmDiscriminator.notnull.Should().Be(true);
        }
 public void WhenSetBasicColumnValuesThenSetPlainValues()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Column(cm =>
     {
         cm.Length(50);
         cm.NotNullable(true);
     });
     hbmDiscriminator.Item.Should().Be.Null();
     hbmDiscriminator.length.Should().Be("50");
     hbmDiscriminator.notnull.Should().Be(true);
 }
 public void WhenSetColumnValuesThenAddColumnTag()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Column(cm =>
     {
         cm.SqlType("VARCHAR(50)");
         cm.NotNullable(true);
     });
     hbmDiscriminator.Item.Should().Not.Be.Null();
     hbmDiscriminator.Columns.Should().Have.Count.EqualTo(1);
 }
 public void WhenSetFormulaThenResetColumn()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Column("MyColumn");
     mapper.Formula("SomeFormula");
     hbmDiscriminator.formula.Should().Be("SomeFormula");
     hbmDiscriminator.column.Should().Be.Null();
     hbmDiscriminator.Item.Should().Be.Null();
 }
 public void SettingFormulaOverridesColumnPlainValues()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Column("colName");
     mapper.Length(10);
     mapper.NotNullable(true);
     mapper.Formula("formula");
     hbmDiscriminator.formula.Should().Be("formula");
     hbmDiscriminator.column.Should().Be(null);
     hbmDiscriminator.length.Should().Be(null);
     hbmDiscriminator.notnull.Should().Be(false);
     hbmDiscriminator.Item.Should().Be.Null();
 }
 public void SettingColumnOverridesFormula()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Formula("formula");
     mapper.Column(cm => cm.Unique(true));
     hbmDiscriminator.formula.Should().Be.Null();
     hbmDiscriminator.Item.Should().Be.OfType<HbmColumn>();
 }
 public void WhenSetFormulaWithNullThenDoNothing()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Column("MyColumn");
     mapper.Formula(null);
     hbmDiscriminator.formula.Should().Be.Null();
     hbmDiscriminator.column.Should().Not.Be.Null();
 }