Ejemplo n.º 1
0
 public void Should_add_multiple_tests()
 {
     _info.AddTestsToRun(new TestToRun[] { new TestToRun(TestRunner.MSTest, "MyAssembly.MyClass.MyTest"), new TestToRun(TestRunner.NUnit, "MyAssembly2.Class.AnotherTest") });
     _info.GetTests().Length.ShouldEqual(2);
     _info.GetTests()[0].Runner.ShouldEqual(TestRunner.MSTest);
     _info.GetTests()[0].Test.ShouldEqual("MyAssembly.MyClass.MyTest");
     _info.GetTests()[1].Runner.ShouldEqual(TestRunner.NUnit);
     _info.GetTests()[1].Test.ShouldEqual("MyAssembly2.Class.AnotherTest");
 }
Ejemplo n.º 2
0
        public void Should_run_tests_for_each_framework_with_an_existing_runner()
        {
            _configuration
            .Stub(x => x.MSpecTestRunner("framework 1"))
            .Return("c:\\runner 1.exe");

            _configuration
            .Stub(x => x.MSpecTestRunner("framework 2"))
            .Return("c:\\runner 2.exe");

            _fileSystem
            .Stub(x => x.FileExists("c:\\runner 2.exe"))
            .Return(true);

            var document1 = new ProjectDocument(ProjectType.CSharp);

            document1.SetFramework("framework 1");
            var info1 = new TestRunInfo(new Project("key 1", document1), "assembly 1");

            var document2 = new ProjectDocument(ProjectType.CSharp);

            document2.SetFramework("framework 2");
            var info2 = new TestRunInfo(new Project("key 2", document2), "assembly 2");

            info2.AddTestsToRun(new[]
            {
                new TestToRun(TestRunner.MSpec, "test 1"),
            });

            var testRunInfos = new[] { info1, info2 };

            _runner.RunTests(testRunInfos, null, null);

            _externalProcess.AssertWasNotCalled(
                x => x.CreateAndWaitForExit(Arg <string> .Matches(y => y == "c:\\runner 1.exe"),
                                            Arg <string> .Is.Anything));

            _externalProcess.AssertWasCalled(
                x => x.CreateAndWaitForExit(Arg <string> .Matches(y => y == "c:\\runner 2.exe"),
                                            Arg <string> .Is.Anything));
        }
Ejemplo n.º 3
0
        public void Should_create_a_filter_file_when_tests_to_run_are_specified()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

            document.SetFramework("framework 1");
            var info = new TestRunInfo(new Project("key 1", document), "assembly 1");

            info.AddTestsToRun(new[]
            {
                new TestToRun(TestRunner.MSpec, "test 1"),
                new TestToRun(TestRunner.MSpec, "test 2")
            });

            var infos = new[] { info };
            var run   = new MSpecTestRunner.Run {
                RunInfos = infos
            };

            var args = _builder.Build(run);

            Assert.That(args, Is.StringContaining("--filter"));
            Assert.That(run.Cleanups.Count(), Is.EqualTo(2), "Should contain cleanup for XML report and filter");
        }