Ejemplo n.º 1
0
        public void ConvertToTestCommandWithNullMethodThrows()
        {
            Action<object> dummyAction = _ => { };
            var sut = new TestCase(dummyAction);

            Assert.Throws<ArgumentNullException>(
                () => sut.ConvertToTestCommand(null));
        }
Ejemplo n.º 2
0
        public void ConvertToTestCommandReturnsResultWithCorrectTestMethod()
        {
            Action<StringComparer> dummyAction = _ => { };
            var sut = new TestCase<StringComparer>(dummyAction);

            var actual = sut.ConvertToTestCommand(anotherMethod);

            var fcc = Assert.IsAssignableFrom<FirstClassCommand>(actual);
            Assert.Equal(anotherMethod, fcc.HostTestMethod);
        }
Ejemplo n.º 3
0
        public void ConvertToTestCommandReturnsCorrectResult()
        {
            Action<object> expected = _ => { };
            var sut = new TestCase(expected);

            ITestCommand actual = sut.ConvertToTestCommand(dummyMethod);

            var fcc = Assert.IsAssignableFrom<FirstClassCommand>(actual);
            Assert.Equal(expected, fcc.TestAction);
        }
Ejemplo n.º 4
0
        public void ConvertToTestCommandReturnsResultWithAppropriateTypeCheck()
        {
            Action<OperatingSystem> dummyAction = _ => { };
            var sut = new TestCase<OperatingSystem>(dummyAction);

            var actual = sut.ConvertToTestCommand(dummyMethod);

            var fcc = Assert.IsAssignableFrom<FirstClassCommand>(actual);
            Assert.Throws<ArgumentException>(
                () => fcc.TestAction(new StringBuilder()));
        }
Ejemplo n.º 5
0
        public void ConvertToTestCommandReturnsCorrectResult()
        {
            var verified = false;
            var input = new Version(1, 1);
            Action<Version> expected = v => verified = input.Equals(v);
            var sut = new TestCase<Version>(expected);

            ITestCommand actual = sut.ConvertToTestCommand(dummyMethod);

            var fcc = Assert.IsAssignableFrom<FirstClassCommand>(actual);
            fcc.TestAction(input);
            Assert.True(
                verified,
                "Invoking TestAction on the resulting FirstClassCommand should indirectly indicate that the original test command was invoked.");
        }