An executable test case, represented as an xUnit.net ITestCommand.

This class is mostly the result of converting an ITestCase instance to an xUnit.net ITestCommand by invoking ITestCase.ConvertToTestCommand(IMethodInfo).

Inheritance: Xunit.Sdk.TestCommand
コード例 #1
0
 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.");
 }
コード例 #2
0
        public void ConstructorCorrectlyAssignsTestMethod()
        {
            Action<object> testAction = _ => { };
            var expected = anotherMethod;
            var sut = new FirstClassCommand(testAction, expected, false);

            var actual = sut.HostTestMethod;

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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.");
        }
コード例 #5
0
 public void SutIsTestCommand()
 {
     Action<object> dummyAction = _ => { };
     var sut = new FirstClassCommand(dummyAction, dummyMethod, false);
     Assert.IsAssignableFrom<ITestCommand>(sut);
 }
コード例 #6
0
        public void ShouldCreateInstanceIsCorrect()
        {
            Action<object> dummyAction = _ => { };
            var expected = true;
            var sut = new FirstClassCommand(dummyAction, dummyMethod, expected);

            var actual = sut.ShouldCreateInstance;

            Assert.Equal(expected, actual);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 public void TestMethodIsCorrect()
 {
     var sut = new FirstClassCommand(_ => { }, anotherMethod, false);
     IMethodInfo actual = sut.HostTestMethod;
     Assert.Equal(anotherMethod, actual);
 }
コード例 #9
0
        public void TestActionIsCorrect()
        {
            Action<object> expected = _ => { };
            var sut = new FirstClassCommand(expected, dummyMethod, false);

            Action<object> actual = sut.TestAction;

            Assert.Equal(expected, actual);
        }