public void WhenSetBasicColumnValuesMoreThanOnceThenMergeColumn() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => cm.Length(50)); mapper.Column(cm => cm.NotNullable(false)); hbmDiscriminator.Item.Should().Be.Null(); hbmDiscriminator.length.Should().Be("50"); hbmDiscriminator.notnull.Should().Be(false); }
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"); }
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 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 WhenSetColumnValuesThenAddColumnTag() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.SqlType("VARCHAR(50)"); cm.NotNullable(false); }); hbmDiscriminator.Item.Should().Not.Be.Null(); hbmDiscriminator.Columns.Should().Have.Count.EqualTo(1); }
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(); }
public void WhenSetBasicColumnValuesThenSetPlainValues() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.Length(50); cm.NotNullable(false); }); hbmDiscriminator.Item.Should().Be.Null(); hbmDiscriminator.length.Should().Be("50"); hbmDiscriminator.notnull.Should().Be(false); }
public void WhenSetColumnValuesThenDefaultNotNullableShouldBeTrue() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.SqlType("VARCHAR(50)"); }); var hbmColumn = hbmDiscriminator.Columns.Single(); hbmColumn.notnullSpecified.Should().Be.True(); hbmColumn.notnull.Should().Be.True(); hbmDiscriminator.notnull.Should().Be.True(); }
public void WhenSetColumnValuesThenOverrideDefaultNotNullable() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.SqlType("VARCHAR(50)"); cm.NotNullable(false); }); var hbmColumn = hbmDiscriminator.Columns.Single(); hbmColumn.notnullSpecified.Should().Be.False(); hbmColumn.notnull.Should().Be.False(); hbmDiscriminator.notnull.Should("the not-null should be the default and should not be present in the mapping.").Be.True(); }
public void WhenSetBasicColumnValuesMoreThanOnceThenMergeColumn() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => cm.Length(50)); mapper.Column(cm => cm.NotNullable(true)); hbmDiscriminator.Item.Should().Be.Null(); hbmDiscriminator.length.Should().Be("50"); hbmDiscriminator.notnull.Should().Be(true); }
public void WhenSetBasicColumnValuesThenSetPlainValues() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.Length(50); cm.NotNullable(true); }); hbmDiscriminator.Item.Should().Be.Null(); hbmDiscriminator.length.Should().Be("50"); hbmDiscriminator.notnull.Should().Be(true); }
public void WhenSetColumnValuesThenAddColumnTag() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Column(cm => { cm.SqlType("VARCHAR(50)"); cm.NotNullable(true); }); hbmDiscriminator.Item.Should().Not.Be.Null(); hbmDiscriminator.Columns.Should().Have.Count.EqualTo(1); }
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 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>(); }