コード例 #1
0
        public void WhenSetBasicColumnValuesMoreThanOnesThenMergeColumn()
        {
            var mapping = new HbmElement();
            var mapper = new ElementMapper(typeof(string), mapping);
            mapper.Column(cm => cm.Length(50));
            mapper.Column(cm => cm.NotNullable(true));

            mapping.Items.Should().Be.Null();
            mapping.length.Should().Be("50");
            mapping.notnull.Should().Be(true);
        }
コード例 #2
0
        public void WhenSetBasicColumnValuesMoreThanOnesThenMergeColumn()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

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

            mapping.Items.Should().Be.Null();
            mapping.length.Should().Be("50");
            mapping.notnull.Should().Be(true);
        }
コード例 #3
0
 public void AfterSetMultiColumnsCantSetSimpleColumn()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Columns(cm => cm.Length(50), cm => cm.SqlType("VARCHAR(10)"));
     ActionAssert.Throws<ConfOrm.MappingException>(() => mapper.Column(cm => cm.Length(50)));
 }
コード例 #4
0
        public void AfterSetMultiColumnsCantSetSimpleColumn()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Columns(cm => cm.Length(50), cm => cm.SqlType("VARCHAR(10)"));
            Executing.This(() => mapper.Column(cm => cm.Length(50))).Should().Throw <MappingException>();
        }
コード例 #5
0
        public void AfterSetMultiColumnsCantSetSimpleColumn()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Columns(cm => cm.Length(50), cm => cm.SqlType("VARCHAR(10)"));
            ActionAssert.Throws <ConfOrm.MappingException>(() => mapper.Column(cm => cm.Length(50)));
        }
 public void SettingColumnOverridesFormula()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Formula("formula");
     mapper.Column(cm => cm.Unique(true));
     mapping.formula.Should().Be.Null();
 }
コード例 #7
0
        public void SettingColumnOverridesFormula()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Formula("formula");
            mapper.Column(cm => cm.Unique(true));
            mapping.formula.Should().Be.Null();
        }
 public void SettingColumnPlainValuesOverridesFormula()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Formula("formula");
     mapper.Column("colName");
     mapping.formula.Should().Be.Null();
     mapping.column.Should().Be("colName");
 }
コード例 #9
0
        public void WhenSetFormulaWithNullThenDoNothing()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column("MyColumn");
            mapper.Formula(null);
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Not.Be.Null();
        }
 public void SettingFormulaOverridesColumnNodes()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), 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 WhenSetColumnNameThenSetTheName()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column(cm => cm.Name("pepe"));

            mapping.Columns.Should().Have.Count.EqualTo(1);
            mapping.Columns.Single().name.Should().Be("pepe");
        }
コード例 #12
0
        public void SettingColumnPlainValuesOverridesFormula()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Formula("formula");
            mapper.Column("colName");
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Be("colName");
        }
コード例 #13
0
        public void WhenSetFormulaThenResetColumn()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column("MyColumn");
            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
            mapping.column.Should().Be.Null();
            mapping.Items.Should().Be.Null();
        }
コード例 #14
0
        public void SettingFormulaOverridesColumnNodes()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), 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();
        }
コード例 #15
0
        public void WhenSetColumnValuesThenAddColumnTag()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column(cm =>
            {
                cm.SqlType("VARCHAR(50)");
                cm.NotNullable(true);
            });
            mapping.Items.Should().Not.Be.Null();
            mapping.Columns.Should().Have.Count.EqualTo(1);
        }
 public void SettingFormulaOverridesColumnPlainValues()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Column("colName");
     mapper.Length(10);
     mapper.NotNullable(true);
     mapper.Formula("formula");
     mapping.formula.Should().Be("formula");
     mapping.column.Should().Be(null);
     mapping.length.Should().Be(null);
     mapping.notnull.Should().Be(false);
     mapping.Items.Should().Be.Null();
 }
コード例 #17
0
        public void SettingFormulaOverridesColumnPlainValues()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column("colName");
            mapper.Length(10);
            mapper.NotNullable(true);
            mapper.Formula("formula");
            mapping.formula.Should().Be("formula");
            mapping.column.Should().Be(null);
            mapping.length.Should().Be(null);
            mapping.notnull.Should().Be(false);
            mapping.Items.Should().Be.Null();
        }
コード例 #18
0
        public void WhenSetBasicColumnValuesThroughShortCutThenMergeColumn()
        {
            var mapping = new HbmElement();
            var mapper  = new ElementMapper(typeof(string), mapping);

            mapper.Column("pizza");
            mapper.Length(50);
            mapper.Precision(10);
            mapper.Scale(2);
            mapper.NotNullable(true);
            mapper.Unique(true);

            mapping.Items.Should().Be.Null();
            mapping.column.Should().Be("pizza");
            mapping.length.Should().Be("50");
            mapping.precision.Should().Be("10");
            mapping.scale.Should().Be("2");
            mapping.notnull.Should().Be(true);
            mapping.unique.Should().Be(true);
        }
 public void WhenSetFormulaWithNullThenDoNothing()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Column("MyColumn");
     mapper.Formula(null);
     mapping.formula.Should().Be.Null();
     mapping.column.Should().Not.Be.Null();
 }
 public void WhenSetFormulaThenResetColumn()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Column("MyColumn");
     mapper.Formula("SomeFormula");
     mapping.formula.Should().Be("SomeFormula");
     mapping.column.Should().Be.Null();
     mapping.Items.Should().Be.Null();
 }
コード例 #21
0
 public void WhenSetColumnValuesThenAddColumnTag()
 {
     var mapping = new HbmElement();
     var mapper = new ElementMapper(typeof(string), mapping);
     mapper.Column(cm =>
     {
         cm.SqlType("VARCHAR(50)");
         cm.NotNullable(true);
     });
     mapping.Items.Should().Not.Be.Null();
     mapping.Columns.Should().Have.Count.EqualTo(1);
 }
コード例 #22
0
        public void WhenSetColumnNameThenSetTheName()
        {
            var mapping = new HbmElement();
            var mapper = new ElementMapper(typeof(string), mapping);
            mapper.Column(cm => cm.Name("pepe"));

            mapping.Columns.Should().Have.Count.EqualTo(1);
            mapping.Columns.Single().name.Should().Be("pepe");
        }
コード例 #23
0
        public void WhenSetBasicColumnValuesThroughShortCutThenMergeColumn()
        {
            var mapping = new HbmElement();
            var mapper = new ElementMapper(typeof(string), mapping);
            mapper.Column("pizza");
            mapper.Length(50);
            mapper.Precision(10);
            mapper.Scale(2);
            mapper.NotNullable(true);
            mapper.Unique(true);

            mapping.Items.Should().Be.Null();
            mapping.column.Should().Be("pizza");
            mapping.length.Should().Be("50");
            mapping.precision.Should().Be("10");
            mapping.scale.Should().Be("2");
            mapping.notnull.Should().Be(true);
            mapping.unique.Should().Be(true);
        }