Skip to content

Commit

Permalink
Add test for redundant references
Browse files Browse the repository at this point in the history
  • Loading branch information
rainersigwald committed Dec 18, 2020
1 parent 1d3aa8f commit 0ee49fc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Tasks.UnitTests/CodeTaskFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,36 @@ public void BuildTaskSimpleCodeFactoryTempDirectoryDoesntExist()
FileUtilities.DeleteDirectoryNoThrow(newTempPath, true);
}
}

/// <summary>
/// Test the simple case where we have a string parameter and we want to log that.
/// </summary>
[Fact]
public void RedundantMSBuildReferences()
{
string projectFileContents = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' ToolsVersion='msbuilddefaulttoolsversion'>
<UsingTask TaskName=`CustomTaskFromCodeFactory_RedundantMSBuildReferences` TaskFactory=`CodeTaskFactory` AssemblyFile=`$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll` >
<ParameterGroup>
<Text/>
</ParameterGroup>
<Task>
<Reference Include='$(MSBuildToolsPath)\Microsoft.Build.Framework.dll' />
<Reference Include='$(MSBuildToolsPath)\Microsoft.Build.Utilities.Core.dll' />
<Code>
Log.LogMessage(MessageImportance.High, Text);
</Code>
</Task>
</UsingTask>
<Target Name=`Build`>
<CustomTaskFromCodeFactory_RedundantMSBuildReferences Text=`Hello, World!` />
</Target>
</Project>";

MockLogger mockLogger = Helpers.BuildProjectWithNewOMExpectSuccess(projectFileContents);
mockLogger.AssertLogContains("Hello, World!");
}
}
#else
public sealed class CodeTaskFactoryTests
Expand Down

0 comments on commit 0ee49fc

Please sign in to comment.