public void Test_SQLCountrecordsaftertruncate() { test = testSuite.Tests["SQL Count records after truncate"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); } // end TestMethod
public void Test_FLCEvaluateexpression() { test = testSuite.Tests["FLC Evaluate expression"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); } // end TestMethod
public void Test_01_OnlyParametersAndVariables() { test = testSuite.Tests["01_OnlyParametersAndVariables"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); } // end TestMethod
public void CheckProjectPathsTest() { string projectFilepath; projectFilepath = UnpackToFile("UTssisUnit.TestPackages.ISPACTesting.ispac", true); var ts = new SsisTestSuite(); ts.PackageList.Add("PackageA", new PackageRef("ExecuteSqlTask", projectFilepath, "ExecuteSqlTask.dtsx", PackageStorageType.FileSystem)); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Project\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString]", "Data Source=.;Initial Catalog=AdventureWorks2012;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;")); Test ssisTest = new Test(ts, "Test", projectFilepath, "ExecuteSqlTask.dtsx", null, "{B56FADB6-02EF-477B-9139-987363F8BCE3}"); ts.Tests.Add("Test", ssisTest); ts.Tests["Test"].Asserts.Add("TestA1", AddNewAssert(ts, ssisTest, "TestA1", "Data Source=.;Initial Catalog=AdventureWorks2012;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;", "\\Project\\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString]")); ts.Tests["Test"].Asserts.Add("TestA2", AddNewAssert(ts, ssisTest, "TestA2", "AdventureWorks2012", "\\Project\\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[InitialCatalog]")); ts.Tests["Test"].Asserts.Add("TestA3", AddNewAssert(ts, ssisTest, "TestA3", DTSProtectionLevel.EncryptSensitiveWithUserKey, "\\Project.Properties[ProtectionLevel]")); ts.Tests["Test"].Asserts.Add("TestA4", AddNewAssert(ts, ssisTest, "TestA4", DTSTargetServerVersion.Latest, "\\Project.Properties[TargetServerVersion]")); ts.Tests["Test"].Asserts.Add("TestA5", AddNewAssert(ts, ssisTest, "TestA5", "ISPACTesting", "\\Project.Properties[Name]")); var context = ts.CreateContext(); ts.Execute(context); context.Log.ApplyTo(log => Debug.Print(log.ItemName + " :: " + string.Join(Environment.NewLine + "\t", log.Messages))); Assert.AreEqual(6, ts.Statistics.GetStatistic(StatisticEnum.AssertPassedCount)); Assert.AreEqual(0, ts.Statistics.GetStatistic(StatisticEnum.AssertFailedCount)); }
public void RunTest(string testName) { Show(); Test test = _testSuite.Tests[testName]; Context context = _testSuite.CreateContext(); test.Execute(context); }
public void TestPackage() { testSuite = new SsisTestSuite(@"C:\Users\Ravi\PalProjects\RandD\SampleSSISUnit\SSISUnitTests\UnitTest_LoadContacts.ssisUnit"); test = testSuite.Tests["TestPackage"]; context = testSuite.CreateContext(); bool rs = test.Execute(context); Assert.AreEqual <bool>(true, rs); }
public void TestBatch1NewDedupContact() { testSuite = new SsisTestSuite(@"C:\Users\Ravi\PalProjects\RandD\SampleSSISUnit\SSISUnitTests\UnitTest_LoadContacts.ssisUnit"); test = testSuite.Tests["TestBatch1NewDedupContact"]; testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = false; context = testSuite.CreateContext(); bool rs = test.Execute(context); Assert.AreEqual <bool>(true, isTestPassed); testSuite.AssertCompleted -= TestSuiteAssertCompleted; }
public void Test_SQLMERGEUsers_Emptytable() { test = testSuite.Tests["SQL MERGE Users: Empty table"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); } // end TestMethod
public void Test_Calculatedefaultdates() { test = testSuite.Tests["Calculate default dates"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); } // end TestMethod
public void CheckVariousPathsTest() { string packageFilepath; #if SQL2005 packageFilepath = UnpackToFile("UTssisUnit.TestPackages.PropertyTest.dtsx"); #elif SQL2008 packageFilepath = UnpackToFile("UTssisUnit.TestPackages.PropertyTest.dtsx"); #elif SQL2014 || SQL2012 packageFilepath = UnpackToFile("UTssisUnit.TestPackages.PropertyTest2012.dtsx"); #elif SQL2017 packageFilepath = UnpackToFile("UTssisUnit.TestPackages.PropertyTest2017.dtsx"); #endif var ts = new SsisTestSuite(); ts.PackageList.Add("PackageA", new PackageRef("PackageA", packageFilepath, PackageStorageType.FileSystem)); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package\Sequence Container\Script Task.Properties[Description]", "Test Descr")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package\Sequence Container.Properties[Description]", "Test Descr")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package\Execute SQL Task.Properties[Description]", "Test Descr")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.Properties[CreationDate]", "2000-01-01")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.Connections[localhost.AdventureWorksDW2008].Properties[Description]", "Test Descr")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value]", false)); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.EventHandlers[OnError].Properties[Description]", "Test Descr")); ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.EventHandlers[OnError]\Script Task.Properties[Description]", "Test Descr")); // Added to verify work item #7188 - multiple periods in object names ts.SetupCommands.Commands.Add(new PropertyCommand(ts, "Set", @"\Package.Connections[test.multple.periods.in.path].Properties[Description]", "Test Descr")); Test ssisTest = new Test(ts, "Test", "PackageA", null, "{7874CCC9-C3C6-40F5-9E8B-1DD62903D845}"); ts.Tests.Add("Test", ssisTest); ts.Tests["Test"].Asserts.Add("TestA", AddNewAssert(ts, ssisTest, "TestA", "Test Descr", "\\Package\\Sequence Container\\Script Task.Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestB", AddNewAssert(ts, ssisTest, "TestB", "Test Descr", "\\Package\\Sequence Container.Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestC", AddNewAssert(ts, ssisTest, "TestC", "Test Descr", "\\Package\\Execute SQL Task.Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestD", AddNewAssert(ts, ssisTest, "TestD", new DateTime(2000, 1, 1), "\\Package.Properties[CreationDate]")); ts.Tests["Test"].Asserts.Add("TestE", AddNewAssert(ts, ssisTest, "TestE", "Test Descr", "\\Package.Connections[localhost.AdventureWorksDW2008].Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestF", AddNewAssert(ts, ssisTest, "TestF", false, "\\Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value]")); ts.Tests["Test"].Asserts.Add("TestG", AddNewAssert(ts, ssisTest, "TestG", "Test Descr", "\\Package.EventHandlers[OnError].Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestH", AddNewAssert(ts, ssisTest, "TestH", "Test Descr", "\\Package.EventHandlers[OnError]\\Script Task.Properties[Description]")); ts.Tests["Test"].Asserts.Add("TestI", AddNewAssert(ts, ssisTest, "TestI", "Test Descr", "\\Package.Connections[test.multple.periods.in.path].Properties[Description]")); var context = ts.CreateContext(); ts.Execute(context); context.Log.ApplyTo(log => Debug.Print(log.ItemName + " :: " + string.Join(Environment.NewLine + "\t", log.Messages))); Assert.AreEqual(10, ts.Statistics.GetStatistic(StatisticEnum.AssertPassedCount)); Assert.AreEqual(0, ts.Statistics.GetStatistic(StatisticEnum.AssertFailedCount)); }
public void DFT_LoadUsers() { test = testSuite.Tests["DFT LoadUsers"]; context = testSuite.CreateContext(); testSuite.AssertCompleted += TestSuiteAssertCompleted; isTestPassed = true; bool rs = test.Execute(context); testSuite.AssertCompleted -= TestSuiteAssertCompleted; Assert.AreEqual <bool>(true, rs, "Package did not execute"); Assert.AreEqual <bool>(true, isTestPassed, System.String.Join(";", messages)); }