SqlServerUnitTest1.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using Microsoft.Data.Tools.Schema.Sql.UnitTesting;
  2. namespace BB_Grishina
  3. {
  4. [TestClass()]
  5. public class SqlServerUnitTest1 : SqlDatabaseTestClass
  6. {
  7. public SqlServerUnitTest1()
  8. {
  9. InitializeComponent();
  10. }
  11. [TestInitialize()]
  12. public void TestInitialize()
  13. {
  14. base.InitializeTest();
  15. }
  16. [TestCleanup()]
  17. public void TestCleanup()
  18. {
  19. base.CleanupTest();
  20. }
  21. [TestMethod()]
  22. public void SqlTest1()
  23. {
  24. SqlDatabaseTestActions testActions = this.SqlTest1Data;
  25. // Execute the pre-test script
  26. //
  27. System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script...");
  28. SqlExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction);
  29. // Execute the test script
  30. //
  31. System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script...");
  32. SqlExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction);
  33. // Execute the post-test script
  34. //
  35. System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script...");
  36. SqlExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction);
  37. }
  38. #region Designer support code
  39. /// <summary>
  40. /// Required method for Designer support - do not modify
  41. /// the contents of this method with the code editor.
  42. /// </summary>
  43. private void InitializeComponent()
  44. {
  45. this.SqlTest1Data = new SqlDatabaseTestActions();
  46. //
  47. // SqlTest1Data
  48. //
  49. this.SqlTest1Data.PosttestAction = null;
  50. this.SqlTest1Data.PretestAction = null;
  51. this.SqlTest1Data.TestAction = null;
  52. }
  53. #endregion
  54. #region Additional test attributes
  55. //
  56. // You can use the following additional attributes as you write your tests:
  57. //
  58. // Use ClassInitialize to run code before running the first test in the class
  59. // [ClassInitialize()]
  60. // public static void MyClassInitialize(TestContext testContext) { }
  61. //
  62. // Use ClassCleanup to run code after all tests in a class have run
  63. // [ClassCleanup()]
  64. // public static void MyClassCleanup() { }
  65. //
  66. #endregion
  67. private SqlDatabaseTestActions SqlTest1Data;
  68. }
  69. }