This class is mostly the result of converting an ITestCase instance to an xUnit.net ITestCommand by invoking ITestCase.ConvertToTestCommand(IMethodInfo).
public void DisplayNameIsNotEmpty() { var sut = new FirstClassCommand(_ => { }, dummyMethod, false); var actual = sut.DisplayName; Assert.False( string.IsNullOrEmpty(actual), "DisplayName should not be null or empty."); }
public void ConstructorCorrectlyAssignsTestMethod() { Action<object> testAction = _ => { }; var expected = anotherMethod; var sut = new FirstClassCommand(testAction, expected, false); var actual = sut.HostTestMethod; Assert.Equal(expected, actual); }
public void ExecuteSuccessfullyReturnsCorrectResult() { Action<object> testAction = _ => { }; var sut = new FirstClassCommand(testAction, anotherMethod, false); var actual = sut.Execute(new object()); var pr = Assert.IsAssignableFrom<PassedResult>(actual); Assert.Equal(anotherMethod.Name, pr.MethodName); Assert.Equal(anotherMethod.TypeName, pr.TypeName); }
public void ExecuteInvokesAction() { var verified = false; var obj = new object(); Action<object> spy = x => verified = x == obj; var sut = new FirstClassCommand(spy, dummyMethod, false); sut.Execute(obj); Assert.True(verified, "Spy should have been invoked."); }
public void SutIsTestCommand() { Action<object> dummyAction = _ => { }; var sut = new FirstClassCommand(dummyAction, dummyMethod, false); Assert.IsAssignableFrom<ITestCommand>(sut); }
public void ShouldCreateInstanceIsCorrect() { Action<object> dummyAction = _ => { }; var expected = true; var sut = new FirstClassCommand(dummyAction, dummyMethod, expected); var actual = sut.ShouldCreateInstance; Assert.Equal(expected, actual); }
public void TimeoutIsCorrect() { var sut = new FirstClassCommand(_ => { }, dummyMethod, false); var actual = sut.Timeout; var expected = MethodUtility.GetTimeoutParameter( Reflector.Wrap(sut.TestAction.Method)); Assert.Equal(expected, actual); }
public void TestMethodIsCorrect() { var sut = new FirstClassCommand(_ => { }, anotherMethod, false); IMethodInfo actual = sut.HostTestMethod; Assert.Equal(anotherMethod, actual); }
public void TestActionIsCorrect() { Action<object> expected = _ => { }; var sut = new FirstClassCommand(expected, dummyMethod, false); Action<object> actual = sut.TestAction; Assert.Equal(expected, actual); }