Пример #1
0
        public void FailedTargets()
        {
            MockLogger logger = ObjectModelHelpers.BuildProjectExpectFailure(@"

                <Project DefaultTargets=`build` ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                    <Target Name=`build` >
	                    <CallTarget Targets=`a; b; c` />
                    </Target>
                    <Target Name=`a` >
	                    <Message Text=`Inside A` />
                    </Target>
                    <Target Name=`b` >
	                    <Error Text=`Inside B` />
                    </Target>
                    <Target Name=`c` >
	                    <Message Text=`Inside C` />
                    </Target>
                </Project>
                ");

            logger.AssertLogContains("Inside A");
            logger.AssertLogContains("Inside B");

            // Target C should not have been run.
            logger.AssertLogDoesntContain("Inside C");
        }
Пример #2
0
        public void FailedTargetsRunSeparately()
        {
            MockLogger logger = ObjectModelHelpers.BuildProjectExpectFailure(@"

                <Project DefaultTargets=`build` ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                    <Target Name=`build` >
	                    <CallTarget Targets=`a; b; c` RunEachTargetSeparately=`true` />
                    </Target>
                    <Target Name=`a` >
	                    <Message Text=`Inside A` />
                    </Target>
                    <Target Name=`b` >
	                    <Error Text=`Inside B` />
                    </Target>
                    <Target Name=`c` >
	                    <Message Text=`Inside C` />
                    </Target>
                </Project>
                ");

            // All three targets should have been run.
            logger.AssertLogContains("Inside A");
            logger.AssertLogContains("Inside B");
            logger.AssertLogContains("Inside C");
        }
Пример #3
0
        public void FailsWithOnlyTargetErrors()
        {
            MockLogger logger = ObjectModelHelpers.BuildProjectExpectFailure(@"
                <Project>
                  <Target Name='Init'>
                    <CallTarget Targets='Inside' />
                  </Target>
                  <Target Name='Inside'>
                    <Error />
                  </Target>
                </Project>");

            logger.ErrorCount.ShouldBe(1);
        }
Пример #4
0
        public void ErrorFromResourcesNoResources()
        {
            string projectContents = @"
<Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
  <Target Name=`Build`>
    <ErrorFromResources />
  </Target>
</Project>
";

            MockLogger logger = ObjectModelHelpers.BuildProjectExpectFailure(projectContents);

            // missing required parameter
            logger.AssertLogContains("MSB4044");
        }