コード例 #1
0
        public void ShouldPassCorrectCommandLineArguments()
        {
            var mockBounce = new Mock<IBounce>();
            var mockShellCommand = new Mock<IShellCommandExecutor>();
            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath = PartCoverPath,
                NUnitConsolePath = NunitConsolePath,
                DllPaths = new[] { Dll1, Dll2 },
                IncludeRules = new[] { "[*]*" },
                ExcludeRules = new[] { "[Iesi.Collections]*", "[Microsoft*]*" },
                RegisterPartCoverDlls = false
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\" /noshadow\" " +
                                        "--include [*]* " +
                                        "--exclude [Iesi.Collections]* " +
                                        "--exclude [Microsoft*]*";

            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }
コード例 #2
0
        public void ShouldPassNunitIncludesAndExcludes()
        {
            var mockBounce       = new Mock <IBounce>();
            var mockShellCommand = new Mock <IShellCommandExecutor>();

            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath         = PartCoverPath,
                NUnitConsolePath      = NunitConsolePath,
                DllPaths              = new[] { Dll1, Dll2 },
                IncludeCategories     = new [] { "UnitTest", "IntegrationTest" },
                ExcludeCategories     = new [] { "Slow" },
                RegisterPartCoverDlls = false
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\" /include=UnitTest,IntegrationTest /exclude=Slow /noshadow\"";

            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }
コード例 #3
0
        public void ShouldPassCorrectCommandLineArguments()
        {
            var mockBounce       = new Mock <IBounce>();
            var mockShellCommand = new Mock <IShellCommandExecutor>();

            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath         = PartCoverPath,
                NUnitConsolePath      = NunitConsolePath,
                DllPaths              = new[] { Dll1, Dll2 },
                IncludeRules          = new[] { "[*]*" },
                ExcludeRules          = new[] { "[Iesi.Collections]*", "[Microsoft*]*" },
                RegisterPartCoverDlls = false
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\" /noshadow\" " +
                                        "--include [*]* " +
                                        "--exclude [Iesi.Collections]* " +
                                        "--exclude [Microsoft*]*";


            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }
コード例 #4
0
        public void ShouldNotPassNoShadowFlagToNUnit()
        {
            var mockBounce = new Mock<IBounce>();
            var mockShellCommand = new Mock<IShellCommandExecutor>();
            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath = PartCoverPath,
                NUnitConsolePath = NunitConsolePath,
                DllPaths = new[] { Dll1, Dll2 },
                ShadowCopyNUnitFiles = true
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--register " +
                                        "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\"\"";

            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }
コード例 #5
0
        public void ShouldNotPassNoShadowFlagToNUnit()
        {
            var mockBounce       = new Mock <IBounce>();
            var mockShellCommand = new Mock <IShellCommandExecutor>();

            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath        = PartCoverPath,
                NUnitConsolePath     = NunitConsolePath,
                DllPaths             = new[] { Dll1, Dll2 },
                ShadowCopyNUnitFiles = true
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--register " +
                                        "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\"\"";

            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }
コード例 #6
0
        public void ShouldPassNunitIncludesAndExcludes()
        {
            var mockBounce = new Mock<IBounce>();
            var mockShellCommand = new Mock<IShellCommandExecutor>();
            mockBounce.Setup(b => b.ShellCommand).Returns(mockShellCommand.Object);

            var sut = new NUnitTestsWithPartCover
            {
                PartCoverPath = PartCoverPath,
                NUnitConsolePath = NunitConsolePath,
                DllPaths = new[] { Dll1, Dll2 },
                IncludeCategories = new [] {"UnitTest", "IntegrationTest"},
                ExcludeCategories = new [] {"Slow"},
                RegisterPartCoverDlls = false
            };

            sut.Build(mockBounce.Object);

            const string expectedArgs = "--output \"partcover.xml\" " +
                                        "--target \"" + NunitConsolePath + "\" " +
                                        "--target-args \"\\\"" + Dll1 + "\\\" \\\"" + Dll2 + "\\\" /include=UnitTest,IntegrationTest /exclude=Slow /noshadow\"";

            mockShellCommand.Verify(msc => msc.ExecuteAndExpectSuccess(PartCoverPath, expectedArgs));
        }