Пример #1
0
        public void ExecuteCommand_CommandReturnsObject_SameObjectIsReturnedToCaller()
        {
            TestResult result = ExecutionWrapper.ExecuteCommand <TestResult>(
                () => new TestResult(TestString));

            Assert.AreEqual(TestString, result.Detail);
        }
Пример #2
0
 public void ExecuteCommand_CommandThrowsAxeWindowsAutomationException_StackTraceIsComplete()
 {
     try
     {
         ExecutionWrapper.ExecuteCommand <TestResult>(ThrowAxeWindowsAutomationException);
     }
     catch (AxeWindowsAutomationException e)
     {
         Assert.IsTrue(e.StackTrace.Contains("ThrowAxeWindowsAutomationException"), "Stack Trace information has been lost");
         throw;
     }
 }
Пример #3
0
 public void ExecuteCommand_CommandIsNull_ThrowsInnerNullReferenceException_Automation003InMessage()
 {
     try
     {
         ExecutionWrapper.ExecuteCommand <TestResult>(null);
     }
     catch (AxeWindowsAutomationException ex)
     {
         Assert.IsInstanceOfType(ex.InnerException, typeof(NullReferenceException));
         Assert.IsTrue(ex.Message.Contains(" Automation003:"));
     }
 }
Пример #4
0
 /// <summary>
 /// Execute the Stop command. Used by both .NET and by PowerShell entry points
 /// </summary>
 /// <returns>A StopCommandResult that describes the result of the command</returns>
 public static StopCommandResult Execute()
 {
     return(ExecutionWrapper.ExecuteCommand(() =>
     {
         AutomationSession.ClearInstance();
         return new StopCommandResult
         {
             Completed = true,
             SummaryMessage = DisplayStrings.SuccessStop,
             Succeeded = true,
         };
     }, ErrorCommandResultFactory));
 }
Пример #5
0
        public void ExecuteCommand_CommandIsNull_CallsErrorFactory_Automation003InDetail()
        {
            TestResult result = ExecutionWrapper.ExecuteCommand <TestResult>(
                null,
                (errorDetail) =>
            {
                return(new TestResult(errorDetail, true));
            });

            Assert.IsTrue(result.IsError);
            Assert.IsTrue(result.Detail.Contains(" Automation003:"));
            Assert.IsTrue(result.Detail.Contains("System.NullReferenceException"));
        }
Пример #6
0
 public void ExecuteCommand_CommandThrowsAutomationException_TestStringInMessage()
 {
     try
     {
         ExecutionWrapper.ExecuteCommand <TestResult>(
             () =>
         {
             throw new AxeWindowsAutomationException(TestString);
         });
     }
     catch (AxeWindowsAutomationException ex)
     {
         Assert.AreEqual(TestString, ex.Message);
     }
 }
Пример #7
0
        public void ExecuteCommand_CommandThrowsAutomationException_CallsErrorFactory_Automation003InDetail()
        {
            TestResult result = ExecutionWrapper.ExecuteCommand <TestResult>(
                () =>
            {
                throw new A11yAutomationException(TestString);
            },
                (errorDetail) =>
            {
                return(new TestResult(errorDetail, true));
            });

            Assert.IsTrue(result.IsError);
            Assert.AreEqual(TestString, result.Detail);
        }
Пример #8
0
 public void ExecuteCommand_CommandThrowsNonAutomationException_WrapsInAutomationException_Automation003InMessage()
 {
     try
     {
         ExecutionWrapper.ExecuteCommand <TestResult>(
             () =>
         {
             throw new ArgumentException(TestString);
         });
     }
     catch (AxeWindowsAutomationException ex)
     {
         Assert.IsInstanceOfType(ex.InnerException, typeof(ArgumentException));
         Assert.IsTrue(ex.Message.Contains(" Automation003:"));
         Assert.IsTrue(ex.Message.Contains(TestString));
     }
 }
Пример #9
0
        public void ExecuteCommand_CommandThrowsNonAutomationException_CallsErrorFactory_Automation003InDetail()
        {
            TestResult result = ExecutionWrapper.ExecuteCommand <TestResult>(
                () =>
            {
                throw new ArgumentException(TestString);
            },
                (errorDetail) =>
            {
                return(new TestResult(errorDetail, true));
            });

            Assert.IsTrue(result.IsError);
            Assert.IsTrue(result.Detail.Contains(" Automation003:"));
            Assert.IsTrue(result.Detail.Contains("System.ArgumentException"));
            Assert.IsTrue(result.Detail.Contains(TestString));
        }