private ScriptResult CompareAndUpdateDatabase(IComparerSettings settings, TestCaseStructure testCaseStructure) { var comparer = CreateComparer(settings); var compareResult = default(ScriptResult); try { compareResult = comparer.Compare().Script; } catch (Exception ex) when(testCaseStructure.ExpectedCompareException?.IsAssignableFrom(ex.GetType()) ?? false) { Assert.Pass(); return(null); } if (testCaseStructure.ExpectedCompareException != null) { Assert.Fail("Expected exception but nothing happened."); return(null); } TestContext.WriteLine("*** Change script:"); var commands = compareResult.AllStatements.ToArray(); foreach (var item in commands) { TestContext.WriteLine(item); } TestContext.WriteLine(); Helpers.Database.ExecuteScript(m_Version, Helpers.Database.DatabaseLocation.Target, commands); return(compareResult); }
private static void ExecuteSpecificAsserts(TestCaseStructure testCaseStructure, ScriptResult compareResult) { testCaseStructure.AssertScript(compareResult); }