public void ExecuteCommand_CommandReturnsObject_SameObjectIsReturnedToCaller() { TestResult result = ExecutionWrapper.ExecuteCommand <TestResult>( () => new TestResult(TestString)); Assert.AreEqual(TestString, result.Detail); }
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; } }
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:")); } }
/// <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)); }
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")); }
public void ExecuteCommand_CommandThrowsAutomationException_TestStringInMessage() { try { ExecutionWrapper.ExecuteCommand <TestResult>( () => { throw new AxeWindowsAutomationException(TestString); }); } catch (AxeWindowsAutomationException ex) { Assert.AreEqual(TestString, ex.Message); } }
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); }
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)); } }
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)); }