Exemplo n.º 1
0
        public void Should_get_framework_spesific_build_executable()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

            document.SetFramework("v3.5");
            _config.BuildExecutable(document).ShouldEqual(@"C:\SomefolderOther\MSBuild.exe");
        }
Exemplo n.º 2
0
        public void Should_check_the_runner_exe_for_each_framework()
        {
            _configuration
            .Stub(x => x.MSpecTestRunner("framework 1"))
            .Return("c:\\runner 1.exe");

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

            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");

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

            _runner.RunTests(testRunInfos, null, null);

            _fileSystem.AssertWasCalled(x => x.FileExists("c:\\runner 1.exe"));
            _fileSystem.AssertWasCalled(x => x.FileExists("c:\\runner 2.exe"));
        }
Exemplo n.º 3
0
        public void Should_build_the_command_line_for_each_run()
        {
            _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(null))
            .IgnoreArguments()
            .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");

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

            _runner.RunTests(testRunInfos, null, null);

            _commandLineBuilder.AssertWasCalled(x => x.Build(null),
                                                o => o.IgnoreArguments().Repeat.Twice());
        }
Exemplo n.º 4
0
        public void Should_get_product_version_spesific_build_executable()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

            document.SetFramework("v3.5");
            document.SetVSVersion("9.0.30729");
            _config.BuildExecutable(document).ShouldEqual(@"C:\ProductVersionFolder\MSBuild.exe");
        }
Exemplo n.º 5
0
        public void Should_merge_two_config_files()
        {
            createMergeFile();
            var document   = new ProjectDocument(ProjectType.CSharp);
            var document35 = new ProjectDocument(ProjectType.CSharp);

            document35.SetFramework("v3.5");
            _config.Merge(_overridConfig);

            _config.BuildExecutable(document).ShouldEqual("");
            _config.NunitTestRunner(document.Framework).ShouldEqual(@"C:\Somefolder\NUnit\nunit-console.exe");
            _config.NunitTestRunner(document35.Framework).ShouldEqual("NewTestRunner");
            _config.GrowlNotify.ShouldEqual("another_growl_notifier");
            _config.TestAssembliesToIgnore[2].ShouldEqual("MergedRule.dll");
            _config.FileChangeBatchDelay.ShouldEqual(800);
        }
Exemplo n.º 6
0
        public void Should_report_the_time_info()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

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

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

            var args = _builder.Build(run);

            Assert.That(args, Is.StringContaining("--timeinfo"));
        }
Exemplo n.º 7
0
        public void Should_not_create_a_filter_file_when_all_tests_are_run()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

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

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

            var args = _builder.Build(run);

            Assert.That(args, Is.Not.StringContaining("--filter"));
        }
Exemplo n.º 8
0
        public void Should_create_the_assembly_list()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

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

            var infos = new[] { info1, info2 };
            var run   = new MSpecTestRunner.Run {
                RunInfos = infos
            };

            var args = _builder.Build(run);

            Assert.That(args, Is.StringContaining(" \"assembly 1\""));
            Assert.That(args, Is.StringContaining(" \"assembly 2\""));
        }
Exemplo n.º 9
0
        public void Should_create_an_xml_report()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

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

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

            var args = _builder.Build(run);

            Assert.That(args, Is.StringContaining("--xml"));
            Assert.That(run.Cleanups.Count(), Is.EqualTo(1));
            Assert.That(run.Harvesters.Count(), Is.EqualTo(1));
        }
Exemplo n.º 10
0
        public void Should_create_the_assembly_list_from_distinct_assembly_names()
        {
            var document = new ProjectDocument(ProjectType.CSharp);

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

            var infos = new[] { info1, info2 };
            var run   = new MSpecTestRunner.Run {
                RunInfos = infos
            };

            var args = _builder.Build(run);

            var assembly1Count = new Regex("assembly 1").Matches(args).Count;

            Assert.That(assembly1Count, Is.EqualTo(1));
        }
Exemplo n.º 11
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));
        }
Exemplo n.º 12
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");
        }
Exemplo n.º 13
0
 public void Should_set_framework()
 {
     _document.SetFramework("v3.5");
     _document.Framework.ShouldEqual("v3.5");
 }