public void DisplayNameIsCorrect() { var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), new Exception()); var actual = sut.DisplayName; Assert.Equal("Jwc.Experiment.Xunit.ExceptionCommandTest.DisplayNameIsCorrect", actual); }
public void ExceptionIsCorrect() { var exception = new Exception(); var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), exception); var actual = sut.Exception; Assert.Equal(exception, actual); }
public void ExecuteReturnsCorrectResult() { var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), new Exception()); var actual = sut.Execute(null); var failedResult = Assert.IsType<FailedResult>(actual); Assert.Equal(sut.MethodName, failedResult.MethodName); Assert.Equal(sut.Exception.GetType().FullName, failedResult.ExceptionType); Assert.Equal(sut.DisplayName, failedResult.DisplayName); }
public void ExecuteRecursivelyUnwrapsTargetInvocationException() { try { this.GetType().GetMethod("ThrowInvalidOperationException2").Invoke(null, new object[0]); Assert.True(false, "TargetInvocationException should be thrown."); } catch (TargetInvocationException exception) { Assert.IsType<TargetInvocationException>(exception.InnerException); var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), exception); var actual = sut.Execute(null); var failedResult = Assert.IsType<FailedResult>(actual); Assert.Equal(typeof(InvalidOperationException).FullName, failedResult.ExceptionType); Assert.Contains( "ExceptionCommandTest.ThrowInvalidOperationException", failedResult.StackTrace); } }
public void TimeoutIsCorrect() { var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), new Exception()); var actual = sut.Timeout; Assert.Equal(0, actual); }
public void SutIsTestCommand() { var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), new Exception()); Assert.IsAssignableFrom<TestCommand>(sut); }
public void MethodNameIsCorrect() { var sut = new ExceptionCommand( Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()), new Exception()); var actual = sut.MethodName; Assert.Equal("MethodNameIsCorrect", actual); }