Пример #1
0
        public void Execute_NoProjectFile_ShouldLookupProjectFileInWorkDirectory()
        {
            var workDirectory = new DirectoryStub("Src")
            {
                new DirectoryStub("DotNet")
                {
                    new DirectoryStub("Build"),
                    new FileStub("Rosalia.sln")
                },
                new DirectoryStub("Artifacts"),
                new DirectoryStub("Scripts")
            };

            var task = new MsBuildTask
            {
                ToolPath = "myMsBuild"
            };

            task.AssertCommand(
                workDirectory["DotNet"]["Build"],
                (msBuildPath, msBuildArguments) =>
                {
                    Assert.That(msBuildArguments.Trim(), Is.EqualTo("Src\\DotNet\\Rosalia.sln"));
                });
        }
Пример #2
0
        public void Execute_HasProjectFile_ShouldGenerateCommandLine()
        {
            var task = new MsBuildTask
            {
                ToolPath = "myMsBuild",
                ProjectFile = new DefaultFile("projectFile")
            };

            task.AssertCommand((msBuildPath, msBuildArguments) =>
            {
                Assert.That(msBuildArguments.Trim(), Is.EqualTo("projectFile"));
            });
        }
Пример #3
0
        public void Execute_NoProjectFileAndNoSolutionInWorkDirectory_ShouldLeaveProjectFileBlank()
        {
            var workDirectory = new DirectoryStub("Src")
            {
                new DirectoryStub("DotNet")
                {
                    new DirectoryStub("Build"),
                },
                new DirectoryStub("Artifacts"),
                new DirectoryStub("Scripts")
            };

            var task = new MsBuildTask
            {
                ToolPath = "myMsBuild"
            };

            task.AssertCommand(
                workDirectory["DotNet"]["Build"],
                (msBuildPath, msBuildArguments) =>
                {
                    Assert.That(msBuildArguments.Trim(), Is.Empty);
                });
        }
Пример #4
0
        public void Execute_ToolPathPrivided_ShouldUseToolPath()
        {
            var task = new MsBuildTask
            {
                ToolPath = "myMsBuild",
                ProjectFile = new DefaultFile("projectFile")
            };

            task.AssertCommand(
                (msBuildPath, msBuildArguments) =>
                {
                    Assert.That(msBuildPath, Is.EqualTo("myMsBuild"));
                });
        }