public void CatSetColumnByName()
        {
            var hbm    = new HbmMapKeyManyToMany();
            var mapper = new MapKeyManyToManyMapper(hbm);

            mapper.Column("pizza");
            hbm.column.Should().Be("pizza");
        }
Example #2
0
        public void WhenSetColumnValuesMoreThanOnesThenMergeColumn()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

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

            mapping.Items.Should().Not.Be.Null();
            var hbmColumn = mapping.Items.OfType <HbmColumn>().First();

            hbmColumn.name.Should().Be("pepe");
            hbmColumn.length.Should().Be("50");
            hbmColumn.notnull.Should().Be(true);
            hbmColumn.notnullSpecified.Should().Be(true);
        }
Example #3
0
        public void SettingColumnOverridesFormula()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

            mapper.Formula("formula");
            mapper.Column(cm => cm.Unique(true));
            mapping.formula.Should().Be.Null();
        }
Example #4
0
        public void WhenSetOnlyColumnNameThenNoAddColumnTag()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

            mapper.Column("pizza");

            mapping.Items.Should().Be.Null();
            mapping.column.Should().Be("pizza");
        }
Example #5
0
        public void SettingColumnPlainValuesOverridesFormula()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

            mapper.Formula("formula");
            mapper.Column("colName");
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Be("colName");
        }
Example #6
0
        public void WhenSetFormulaWithNullThenDoNothing()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

            mapper.Column("MyColumn");
            mapper.Formula(null);
            mapping.formula.Should().Be.Null();
            mapping.column.Should().Not.Be.Null();
        }
Example #7
0
        public void WhenSetColumnNameThenSetTheName()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

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

            mapping.Columns.Should().Have.Count.EqualTo(1);
            mapping.Columns.Single().name.Should().Be("pepe");
        }
Example #8
0
        public void SettingFormulaOverridesColumnNodes()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(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();
        }
Example #9
0
        public void WhenSetFormulaThenResetColumn()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

            mapper.Column("MyColumn");
            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
            mapping.column.Should().Be.Null();
            mapping.Items.Should().Be.Null();
        }
Example #10
0
        public void WhenSetColumnValuesThenAddColumnTag()
        {
            var mapping = new HbmMapKeyManyToMany();
            var mapper  = new MapKeyManyToManyMapper(mapping);

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