public void EmptiesResultListBeforeRunning()
        {
            var wrapper      = new Mock <IExecutorWrapper>();
            var callback     = new Mock <ITestMethodRunnerCallback>();
            var testMethod   = new TestMethod("testMethod", null, null);
            var testClass    = new TestableTestClass("typeName", new[] { testMethod });
            var testAssembly = new TestAssembly(wrapper.Object, new[] { testClass });

            testMethod.RunResults.Add(new TestPassedResult(1.23, "displayName", null));

            testClass.Run(new[] { testMethod }, callback.Object);

            Assert.Empty(testMethod.RunResults);
        }
        public void CallsTestRunnerWithTestList()
        {
            var wrapper      = new Mock <IExecutorWrapper>();
            var callback     = new Mock <ITestMethodRunnerCallback>();
            var testMethod1  = new TestMethod("testMethod1", null, null);
            var testMethod2  = new TestMethod("testMethod2", null, null);
            var testMethod3  = new TestMethod("testMethod3", null, null);
            var testClass    = new TestableTestClass("typeName", new[] { testMethod1, testMethod2, testMethod3 });
            var testAssembly = new TestAssembly(wrapper.Object, new[] { testClass });

            var result = testClass.Run(new[] { testMethod1, testMethod2, testMethod3 }, callback.Object);

            Assert.Single(testClass.RunTests_Methods, "testMethod1");
            Assert.Single(testClass.RunTests_Methods, "testMethod2");
            Assert.Single(testClass.RunTests_Methods, "testMethod3");
            Assert.Same(callback.Object, testClass.RunTests_Callback);
            Assert.Equal(testClass.RunTests_ReturnValue, result);
        }
Beispiel #3
0
        public void EmptiesResultListBeforeRunning()
        {
            var wrapper = new Mock<IExecutorWrapper>();
            var callback = new Mock<ITestMethodRunnerCallback>();
            var testMethod = new TestMethod("testMethod", null, null);
            var testClass = new TestableTestClass("typeName", new[] { testMethod });
            var testAssembly = new TestAssembly(wrapper.Object, new[] { testClass });
            testMethod.RunResults.Add(new TestPassedResult(1.23, "displayName", null));

            testClass.Run(new[] { testMethod }, callback.Object);

            Assert.Empty(testMethod.RunResults);
        }
Beispiel #4
0
        public void CallsTestRunnerWithTestList()
        {
            var wrapper = new Mock<IExecutorWrapper>();
            var callback = new Mock<ITestMethodRunnerCallback>();
            var testMethod1 = new TestMethod("testMethod1", null, null);
            var testMethod2 = new TestMethod("testMethod2", null, null);
            var testMethod3 = new TestMethod("testMethod3", null, null);
            var testClass = new TestableTestClass("typeName", new[] { testMethod1, testMethod2, testMethod3 });
            var testAssembly = new TestAssembly(wrapper.Object, new[] { testClass });

            var result = testClass.Run(new[] { testMethod1, testMethod2, testMethod3 }, callback.Object);

            Assert.Single(testClass.RunTests_Methods, "testMethod1");
            Assert.Single(testClass.RunTests_Methods, "testMethod2");
            Assert.Single(testClass.RunTests_Methods, "testMethod3");
            Assert.Same(callback.Object, testClass.RunTests_Callback);
            Assert.Equal(testClass.RunTests_ReturnValue, result);
        }
Beispiel #5
0
        public void CallsTestRunnerWithTestList()
        {
            var wrapper = new Mock<IExecutorWrapper>();
            var callback = new Mock<ITestMethodRunnerCallback>();
            var testMethod1 = new TestMethod("testMethod1", null, null);
            var testMethod2 = new TestMethod("testMethod2", null, null);
            var testMethod3 = new TestMethod("testMethod3", null, null);
            var testClass = new TestableTestClass("typeName", new[] { testMethod1, testMethod2, testMethod3 });
            var testAssembly = new TestAssembly(wrapper.Object, new[] { testClass });

            testClass.Run(new[] { testMethod1, testMethod2, testMethod3 }, callback.Object);

            testClass.TestRunner.Verify(r => r.RunTests("typeName", new List<string> { "testMethod1", "testMethod2", "testMethod3" }));
        }