Esempio n. 1
0
 public void TestStateProperty()
 {
     // Check state is correct UserflowState after
     // various Userflow method calls.
     {
         Userflow example1 = ExampleUserflow();
         Assert.IsTrue(example1.State() == UserflowState.CREATED,
                       "Expecting UserflowState.CREATED .");
         {
             example1.Begin();;
             Assert.IsTrue(example1.State() == UserflowState.BEGUN,
                           "Expecting UserflowState.BEGUN .");
         }
         Thread.Sleep(100);
         {
             example1.End();;
             Assert.IsTrue(example1.State() == UserflowState.ENDED,
                           "Expecting UserflowState.ENDED .");
         }
     }
     {
         Userflow example2 = ExampleUserflow();
         Assert.IsTrue(example2.State() == UserflowState.CREATED,
                       "Expecting UserflowState.CREATED .");
         {
             example2.Begin();;
             Assert.IsTrue(example2.State() == UserflowState.BEGUN,
                           "Expecting UserflowState.BEGUN .");
         }
         Thread.Sleep(100);
         {
             example2.Fail();
             Assert.IsTrue(example2.State() == UserflowState.FAILED,
                           "Expecting UserflowState.FAILED .");
         }
     }
     {
         Userflow example3 = ExampleUserflow();
         Assert.IsTrue(example3.State() == UserflowState.CREATED,
                       "Expecting UserflowState.CREATED .");
         const int timeout = 100;
         example3.SetTimeout(timeout);
         {
             example3.Begin();
             Assert.IsTrue(example3.State() == UserflowState.BEGUN,
                           "Expecting UserflowState.BEGUN .");
         }
         // Yield here so CLR can operate example3's timer .
         Thread.Sleep(2 * timeout);
         Assert.IsTrue(example3.State() == UserflowState.TIMEOUT,
                       "Expecting UserflowState.TIMEOUT .");
     }
 }
Esempio n. 2
0
        public void TestFail()
        {
            // Test "Fail"'s resulting state is correct.  It's required to "begin" first.
            Userflow example = ExampleUserflow();

            example.Begin();
            Assert.IsTrue(example.State() == UserflowState.BEGUN,
                          "Confirm Begin changes state to UserflowState.BEGUN");
            example.Fail();
            Assert.IsTrue(example.State() == UserflowState.FAILED,
                          "Confirm Fail changes state to UserflowState.FAILED");
        }