Ejemplo n.º 1
0
        public void SettingColumnOverridesFormula()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Formula("formula");
            mapper.Column(cm => cm.Unique(true));
            mapping.formula.Should().Be.Null();
        }
Ejemplo n.º 2
0
        public void WhenSetDefaultColumnNameThenDoesNotSetTheName()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Column(cm => cm.Name("MyClass"));
            mapping.column.Should().Be.Null();
            mapping.Columns.Should().Be.Empty();
        }
Ejemplo n.º 3
0
        public void WhenSetDifferentColumnNameThenSetTheName()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

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

            mapping.Columns.Should().Have.Count.EqualTo(1);
            mapping.Columns.Single().name.Should().Be("pepe");
        }
Ejemplo n.º 4
0
        public void SettingColumnPlainValuesOverridesFormula()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Formula("formula");
            mapper.Column("colName");
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Be("colName");
        }
Ejemplo n.º 5
0
        public void WhenSetFormulaWithNullThenDoNothing()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Column("MyColumn");
            mapper.Formula(null);
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Not.Be.Null();
        }
Ejemplo n.º 6
0
        public void WhenSetFormulaThenResetColumn()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Column("MyColumn");
            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
            mapping.column.Should().Be.Null();
            mapping.Items.Should().Be.Null();
        }
Ejemplo n.º 7
0
        public void SettingFormulaOverridesColumnNodes()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            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();
        }
Ejemplo n.º 8
0
        public void WhenSetColumnValuesThenAddColumnTag()
        {
            var mapping = new HbmManyToMany();
            var mapper  = new ManyToManyMapper(typeof(MyClass), mapping, null);

            mapper.Column(cm =>
            {
                cm.SqlType("VARCHAR(3)");
                cm.NotNullable(true);
            });
            mapping.Columns.Should().Not.Be.Null();
            mapping.Columns.Should().Have.Count.EqualTo(1);
        }