daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Aug 15th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How do I sense if my unit test is a member of an ordered test and, if it is, which position in that ordered test it is at?
  2. [ClassInitialize]
  3. static public void ClassInit(TestContext context)
  4. {
  5.     Playback.Initialize();
  6.     try
  7.     {
  8.         sharedTest.OpenCustomerKeeper();
  9.  
  10.     }
  11.     finally
  12.     {
  13.         Playback.Cleanup();
  14.     }
  15.  
  16. }
  17.    
  18. Code
  19.    
  20. public partial class UIMap
  21. {
  22.     #region Class Initializization and Cleanup
  23.     static private UIMap sharedTest = new UIMap();
  24.  
  25.     [ClassInitialize]
  26.     static public void ClassInit(TestContext context)
  27.     {
  28.         Playback.Initialize();
  29.         try
  30.         {
  31.             sharedTest.OpenWindow();
  32.         }
  33.         finally
  34.         {
  35.             Playback.Cleanup();
  36.         }
  37.     }
  38.  
  39.     [ClassCleanup]
  40.     static public void ClassCleanup()
  41.     {
  42.         Playback.Initialize();
  43.         try
  44.         {
  45.  
  46.             sharedTest.CloseWindow();
  47.         }
  48.         finally
  49.         {
  50.             Playback.Cleanup();
  51.         }
  52.     }
  53.     #endregion
  54.    
  55. using System.Data;
  56. using System.Data.Common;
  57. using System.Configuration;
  58. using Microsoft.VisualStudio.TestTools.UnitTesting;
  59. using Microsoft.Data.Schema.UnitTesting;
  60. using System.Windows.Input;
  61. using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
  62. using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
  63. using MouseButtons = System.Windows.Forms.MouseButtons;
  64.  
  65. namespace CSIS_TEST
  66. {
  67.     [TestClass()]
  68.     public class DatabaseSetup
  69.     {
  70.         static private UIMap uIMap = new UIMap();
  71.         static int count = 0;
  72.  
  73.         [AssemblyInitialize()]
  74.         public static void InitializeAssembly(TestContext ctx)
  75.         {
  76.             DatabaseTestClass.TestService.DeployDatabaseProject();
  77.             DatabaseTestClass.TestService.GenerateData();
  78.  
  79.             if(count < 1)
  80.                 uIMap.OpenWindow();
  81.             count++;
  82.         }
  83.  
  84.         [AssemblyCleanup()]
  85.         public static void InitializeAssembly()
  86.         {            
  87.             uIMap.CloseWindow();
  88.         }
  89.     }
  90. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top