本文整理匯總了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");
}