public void update_is_second_in_priority() { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); var table2 = new Table(new DbObjectName("public", "sometable2")); var table3 = new Table(new DbObjectName("public", "sometable3")); var table4 = new Table(new DbObjectName("public", "sometable4")); //patch.Log(table1, SchemaPatchDifference.Invalid); patch.Log(table2, SchemaPatchDifference.Create); patch.Log(table3, SchemaPatchDifference.None); patch.Log(table4, SchemaPatchDifference.Update); patch.Difference.ShouldBe(SchemaPatchDifference.Update); }
public void invalid_wins_over_all_else() { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); var table2 = new Table(new DbObjectName("public", "sometable2")); var table3 = new Table(new DbObjectName("public", "sometable3")); var table4 = new Table(new DbObjectName("public", "sometable4")); patch.Log(table1, SchemaPatchDifference.Invalid); patch.Log(table2, SchemaPatchDifference.Create); patch.Log(table3, SchemaPatchDifference.None); patch.Log(table4, SchemaPatchDifference.Update); patch.Difference.ShouldBe(SchemaPatchDifference.Invalid); }
public void return_none_if_no_changes_detected() { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); var table2 = new Table(new DbObjectName("public", "sometable2")); var table3 = new Table(new DbObjectName("public", "sometable3")); var table4 = new Table(new DbObjectName("public", "sometable4")); patch.Log(table1, SchemaPatchDifference.None); patch.Log(table2, SchemaPatchDifference.None); patch.Log(table3, SchemaPatchDifference.None); patch.Log(table4, SchemaPatchDifference.None); patch.Difference.ShouldBe(SchemaPatchDifference.None); }
public void create_takes_precedence_over_none() { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); var table2 = new Table(new DbObjectName("public", "sometable2")); var table3 = new Table(new DbObjectName("public", "sometable3")); var table4 = new Table(new DbObjectName("public", "sometable4")); //patch.Log(table1, SchemaPatchDifference.Invalid); patch.Log(table2, SchemaPatchDifference.Create); patch.Log(table3, SchemaPatchDifference.None); //patch.Log(table4, SchemaPatchDifference.Update); patch.Difference.ShouldBe(SchemaPatchDifference.Create); }
public void should_not_throw_exception_on_assertion(SchemaPatchDifference difference, AutoCreate autoCreate) { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); patch.Log(table1, difference); patch.AssertPatchingIsValid(autoCreate); }
public void should_throw_exception_on_assertion(SchemaPatchDifference difference, AutoCreate autoCreate) { var patch = new SchemaPatch(new DdlRules()); var table1 = new Table(new DbObjectName("public", "sometable1")); patch.Log(table1, difference); Exception <InvalidOperationException> .ShouldBeThrownBy(() => { patch.AssertPatchingIsValid(autoCreate); }); }