本文整理汇总了C#中MockLogger.ClearLog方法的典型用法代码示例。如果您正苦于以下问题:C# MockLogger.ClearLog方法的具体用法?C# MockLogger.ClearLog怎么用?C# MockLogger.ClearLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockLogger
的用法示例。
在下文中一共展示了MockLogger.ClearLog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemGroupWithConditionOnGroup
public void ItemGroupWithConditionOnGroup()
{
MockLogger logger = new MockLogger();
Project p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t'>
<ItemGroup Condition='false'>
<i1 Include='a1'/>
<i2 Include='b1'/>
</ItemGroup>
<Message Text='[@(i1)][@(i2)]'/>
</Target>
</Project>"))));
p.Build(new string[] { "t" }, new ILogger[] { logger });
logger.AssertLogDoesntContain("[a1][b1]");
logger.ClearLog();
p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t'>
<ItemGroup Condition='true'>
<i1 Include='a1'/>
<i2 Include='b1'/>
</ItemGroup>
<Message Text='[@(i1)][@(i2)]'/>
</Target>
</Project>"))));
p.Build(new string[] { "t" }, new ILogger[] { logger });
logger.AssertLogContains("[a1][b1]");
}
示例2: ItemAndTargetConditionsEvaluatedUsingProjectsDirectory
public void ItemAndTargetConditionsEvaluatedUsingProjectsDirectory()
{
string tempFile = Path.GetTempFileName();
string relativeTempFile = Path.GetFileName(tempFile);
string projectFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
<Project xmlns=`msbuildnamespace`>
<ItemGroup>
<i Include=`i1` Condition=`exists('{0}')`/>
</ItemGroup>
<Target Name=`t` Condition=`exists('{0}')`>
<Message Text=`[@(i)]`/>
</Target>
</Project>
", relativeTempFile);
try
{
MockLogger logger = new MockLogger();
Project project = LoadAndBuildInDifferentCurrentDirectory(projectFile, logger);
logger.AssertLogContains("[i1]");
logger.ClearLog();
DirtyAndBuildInDifferentCurrentDirectory(project);
logger.AssertLogContains("[i1]");
}
finally
{
File.Delete(projectFile);
File.Delete(tempFile);
}
}
示例3: PropertyGroupWithConditionOnGroup
public void PropertyGroupWithConditionOnGroup()
{
MockLogger logger = new MockLogger();
Project p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t'>
<PropertyGroup Condition='false'>
<p1>v1</p1>
<p2>v2</p2>
</PropertyGroup>
<Message Text='[$(P1)][$(P2)]'/>
</Target>
</Project>"))));
p.Build(new string[] { "t" }, new ILogger[] { logger });
logger.AssertLogDoesntContain("[v1][v2]");
logger.ClearLog();
p = new Project(XmlReader.Create(new StringReader(ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t'>
<PropertyGroup Condition='true'>
<p1>v1</p1>
<p2>v2</p2>
</PropertyGroup>
<Message Text='[$(P1)][$(P2)]'/>
</Target>
</Project>"))));
p.Build(new string[] { "t" }, new ILogger[] { logger });
logger.AssertLogContains("[v1][v2]");
}
示例4: ImportConditionsEvaluatedUsingProjectsDirectory
public void ImportConditionsEvaluatedUsingProjectsDirectory()
{
string importFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
<Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
<Target Name=`t`>
<Message Text=`[in import]`/>
</Target>
</Project>
");
// Import the file (and express the import condition) using a *relative* path
string importFileRelative = Path.GetFileName(importFile);
string projectFile = ObjectModelHelpers.CreateTempFileOnDisk(@"
<Project xmlns=`msbuildnamespace`>
<Import Project=`{0}` Condition=`exists('{0}')` />
</Project>
", importFileRelative);
string currentDirectory = Environment.CurrentDirectory;
try
{
MockLogger logger = new MockLogger();
Project project = LoadAndBuildInDifferentCurrentDirectory(projectFile, logger);
logger.AssertLogContains("[in import]");
logger.ClearLog();
DirtyAndBuildInDifferentCurrentDirectory(project);
logger.AssertLogContains("[in import]");
}
finally
{
File.Delete(projectFile);
File.Delete(importFile);
Environment.CurrentDirectory = currentDirectory;
}
}