本文整理汇总了C#中MockLogger.AssertNoWarnings方法的典型用法代码示例。如果您正苦于以下问题:C# MockLogger.AssertNoWarnings方法的具体用法?C# MockLogger.AssertNoWarnings怎么用?C# MockLogger.AssertNoWarnings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockLogger
的用法示例。
在下文中一共展示了MockLogger.AssertNoWarnings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OneSubmissionTwoLoggers
public void OneSubmissionTwoLoggers()
{
string projectBody = ObjectModelHelpers.CleanupFileContents(@"
<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='Test'>
<Message Text='Foo'/>
<Error Text='Error'/>
</Target>
</Project>
");
ProjectInstance project = (new Project(XmlReader.Create(new StringReader(projectBody)))).CreateProjectInstance();
BuildManager buildManager = BuildManager.DefaultBuildManager;
MuxLogger muxLogger = new MuxLogger();
BuildParameters parameters = new BuildParameters(ProjectCollection.GlobalProjectCollection);
parameters.Loggers = new ILogger[] { muxLogger };
MockLogger mockLogger1 = new MockLogger();
MockLogger mockLogger2 = new MockLogger();
buildManager.BeginBuild(parameters);
try
{
BuildSubmission submission = buildManager.PendBuildRequest(new BuildRequestData(project, new string[0], null));
muxLogger.RegisterLogger(submission.SubmissionId, mockLogger1);
muxLogger.RegisterLogger(submission.SubmissionId, mockLogger2);
submission.Execute();
}
finally
{
buildManager.EndBuild();
}
mockLogger1.AssertLogContains("Foo");
mockLogger1.AssertLogContains("Error");
Assert.Equal(1, mockLogger1.ErrorCount);
mockLogger1.AssertNoWarnings();
mockLogger2.AssertLogContains("Foo");
mockLogger2.AssertLogContains("Error");
Assert.Equal(1, mockLogger2.ErrorCount);
mockLogger2.AssertNoWarnings();
Assert.Equal(mockLogger1.FullLog, mockLogger2.FullLog);
}
示例2: BatchingConsidersItemDefinitionMetadata
public void BatchingConsidersItemDefinitionMetadata()
{
string content =
ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion=""msbuilddefaulttoolsversion"" xmlns=""msbuildnamespace"">
<ItemDefinitionGroup>
<i>
<m>m1</m>
</i>
</ItemDefinitionGroup>
<ItemGroup>
<i Include='a.foo;a.bar'/>
</ItemGroup>
<Target Name='t'>
<Message Text='@(i)/%(m)'/>
</Target>
</Project>");
Project project = new Project(XmlReader.Create(new StringReader(content)));
MockLogger logger = new MockLogger();
List<ILogger> loggers = new List<ILogger>() { logger };
Assert.Equal(true, project.Build(loggers));
logger.AssertLogContains("a.foo;a.bar/m1");
logger.AssertNoErrors();
logger.AssertNoWarnings();
}