public void CanSetFormula() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); mapper.Formula("SomeFormula"); hbmDiscriminator.formula.Should().Be("SomeFormula"); }
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 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 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 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 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 WhenSetFormulaWithMultipleLinesThenSetFormulaNode() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); var formula = @"Line1 Line2"; mapper.Formula(formula); hbmDiscriminator.formula.Should().Be.Null(); hbmDiscriminator.Item.Should().Not.Be.Null().And.Be.OfType <HbmFormula>(); var hbmFormula = (HbmFormula)(hbmDiscriminator.Item); hbmFormula.Text.Length.Should().Be(2); hbmFormula.Text[0].Should().Be("Line1"); hbmFormula.Text[1].Should().Be("Line2"); }
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 WhenSetFormulaWithMultipleLinesThenSetFormulaNode() { var hbmDiscriminator = new HbmDiscriminator(); var mapper = new DiscriminatorMapper(hbmDiscriminator); var formula = @"Line1 Line2"; mapper.Formula(formula); hbmDiscriminator.formula.Should().Be.Null(); hbmDiscriminator.Item.Should().Not.Be.Null().And.Be.OfType<HbmFormula>(); var hbmFormula = (HbmFormula) (hbmDiscriminator.Item); hbmFormula.Text.Length.Should().Be(2); hbmFormula.Text[0].Should().Be("Line1"); hbmFormula.Text[1].Should().Be("Line2"); }
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(); }