public void SettingColumnOverridesFormula()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     mapper.Formula("formula");
     mapper.Column(cm => cm.Unique(true));
     mapping.formula.Should().Be.Null();
 }
示例#2
0
        public void CanSetFormula()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
        }
        public void CanSetFormula()
        {
            var mapping = new HbmMapKey();
            var mapper = new MapKeyMapper(mapping);

            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
        }
示例#4
0
        public void SettingColumnOverridesFormula()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Formula("formula");
            mapper.Column(cm => cm.Unique(true));
            mapping.formula.Should().Be.Null();
        }
 public void SettingColumnPlainValuesOverridesFormula()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     mapper.Formula("formula");
     mapper.Column("colName");
     mapping.formula.Should().Be.Null();
     mapping.column.Should().Be("colName");
 }
示例#6
0
        public void SettingColumnPlainValuesOverridesFormula()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Formula("formula");
            mapper.Column("colName");
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Be("colName");
        }
示例#7
0
        public void WhenSetFormulaWithNullThenDoNothing()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Column("MyColumn");
            mapper.Formula(null);
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Not.Be.Null();
        }
 public void SettingFormulaOverridesColumnNodes()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     mapper.Column(cm => cm.SqlType("VARCHAR(80)"));
     mapper.Formula("formula");
     mapping.formula.Should().Be("formula");
     mapping.column.Should().Be(null);
     mapping.Items.Should().Be.Null();
 }
示例#9
0
        public void WhenSetFormulaThenResetColumn()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Column("MyColumn");
            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
            mapping.column.Should().Be.Null();
            mapping.Items.Should().Be.Null();
        }
示例#10
0
        public void SettingFormulaOverridesColumnNodes()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);

            mapper.Column(cm => cm.SqlType("VARCHAR(80)"));
            mapper.Formula("formula");
            mapping.formula.Should().Be("formula");
            mapping.column.Should().Be(null);
            mapping.Items.Should().Be.Null();
        }
示例#11
0
        public void WhenSetFormulaWithMultipleLinesThenSetFormulaNode()
        {
            var mapping = new HbmMapKey();
            var mapper  = new MapKeyMapper(mapping);
            var formula = @"Line1
Line2";

            mapper.Formula(formula);
            mapping.formula.Should().Be.Null();
            mapping.Items.FirstOrDefault().Should().Not.Be.Null().And.Be.OfType <HbmFormula>();
            var hbmFormula = (HbmFormula)(mapping.Items.First());

            hbmFormula.Text.Length.Should().Be(2);
            hbmFormula.Text[0].Should().Be("Line1");
            hbmFormula.Text[1].Should().Be("Line2");
        }
 public void WhenSetFormulaWithMultipleLinesThenSetFormulaNode()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     var formula = @"Line1
     Line2";
     mapper.Formula(formula);
     mapping.formula.Should().Be.Null();
     mapping.Items.FirstOrDefault().Should().Not.Be.Null().And.Be.OfType<HbmFormula>();
     var hbmFormula = (HbmFormula)(mapping.Items.First());
     hbmFormula.Text.Length.Should().Be(2);
     hbmFormula.Text[0].Should().Be("Line1");
     hbmFormula.Text[1].Should().Be("Line2");
 }
 public void WhenSetFormulaThenResetColumn()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     mapper.Column("MyColumn");
     mapper.Formula("SomeFormula");
     mapping.formula.Should().Be("SomeFormula");
     mapping.column.Should().Be.Null();
     mapping.Items.Should().Be.Null();
 }
 public void WhenSetFormulaWithNullThenDoNothing()
 {
     var mapping = new HbmMapKey();
     var mapper = new MapKeyMapper(mapping);
     mapper.Column("MyColumn");
     mapper.Formula(null);
     mapping.formula.Should().Be.Null();
     mapping.column.Should().Not.Be.Null();
 }