public void CanSetFormula()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     mapper.Formula("SomeFormula");
     hbmDiscriminator.formula.Should().Be("SomeFormula");
 }
示例#2
0
        public void CanSetFormula()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);

            mapper.Formula("SomeFormula");
            hbmDiscriminator.formula.Should().Be("SomeFormula");
        }
示例#3
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();
        }
示例#4
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>();
        }
示例#5
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");
        }
示例#6
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();
        }
示例#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 WhenSetFormulaWithMultipleLinesThenSetFormulaNode()
        {
            var hbmDiscriminator = new HbmDiscriminator();
            var mapper           = new DiscriminatorMapper(hbmDiscriminator);
            var formula          = @"Line1
Line2";

            mapper.Formula(formula);
            hbmDiscriminator.formula.Should().Be.Null();
            hbmDiscriminator.Item.Should().Not.Be.Null().And.Be.OfType <HbmFormula>();
            var hbmFormula = (HbmFormula)(hbmDiscriminator.Item);

            hbmFormula.Text.Length.Should().Be(2);
            hbmFormula.Text[0].Should().Be("Line1");
            hbmFormula.Text[1].Should().Be("Line2");
        }
 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();
 }
 public void WhenSetFormulaWithMultipleLinesThenSetFormulaNode()
 {
     var hbmDiscriminator = new HbmDiscriminator();
     var mapper = new DiscriminatorMapper(hbmDiscriminator);
     var formula = @"Line1
     Line2";
     mapper.Formula(formula);
     hbmDiscriminator.formula.Should().Be.Null();
     hbmDiscriminator.Item.Should().Not.Be.Null().And.Be.OfType<HbmFormula>();
     var hbmFormula = (HbmFormula) (hbmDiscriminator.Item);
     hbmFormula.Text.Length.Should().Be(2);
     hbmFormula.Text[0].Should().Be("Line1");
     hbmFormula.Text[1].Should().Be("Line2");
 }
 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 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");
 }