本文整理汇总了C#中MonoTests.Microsoft.Build.Tasks.TestMessageLogger.CheckAny方法的典型用法代码示例。如果您正苦于以下问题:C# TestMessageLogger.CheckAny方法的具体用法?C# TestMessageLogger.CheckAny怎么用?C# TestMessageLogger.CheckAny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoTests.Microsoft.Build.Tasks.TestMessageLogger
的用法示例。
在下文中一共展示了TestMessageLogger.CheckAny方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTargetBatching5
public void TestTargetBatching5 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
Assert.AreEqual (1, testLogger.CheckAny ("TargetStarted", MessageImportance.Normal),
"A2: Target should've been skipped because of no inputs");
CheckEngineEventCounts (testLogger, 1, 1, 0, 0);
}
示例2: CheckLoggedMessageAny
void CheckLoggedMessageAny (TestMessageLogger logger, string expected, string id)
{
if (logger.CheckAny (expected, MessageImportance.Normal) == 1)
Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
}
示例3: TestExecution
public void TestExecution ()
{
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Target Name='1'>
<Message Text='Text1' Importance='Low'/>
<Message Text='Text2' Importance='Normal'/>
<Message Text='Text3' Importance='High'/>
<Message Text='Text4' Importance='low'/>
<Message Text='Text5' Importance='normal'/>
<Message Text='Text6' Importance='high'/>
<Message Text='Text7' />
<Message Text='Text8' Importance='weird_importance'/>
</Target>
</Project>
";
engine = new Engine (Consts.BinPath);
testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
if (project.Build ("1")) {
testLogger.DumpMessages ();
Assert.Fail ("Build should have failed");
}
Assert.AreEqual (0, testLogger.CheckAny ("Text1", MessageImportance.Low), "A1");
Assert.AreEqual (0, testLogger.CheckAny ("Text2", MessageImportance.Normal), "A2");
Assert.AreEqual (0, testLogger.CheckAny ("Text3", MessageImportance.High), "A3");
Assert.AreEqual (0, testLogger.CheckAny ("Text4", MessageImportance.Low), "A4");
Assert.AreEqual (0, testLogger.CheckAny ("Text5", MessageImportance.Normal), "A5");
Assert.AreEqual (0, testLogger.CheckAny ("Text6", MessageImportance.High), "A6");
Assert.AreEqual (0, testLogger.CheckAny ("Text7", MessageImportance.Normal), "A7");
Assert.AreEqual (1, testLogger.CheckAny ("Text8", MessageImportance.Normal), "A8");
}