当前位置: 首页>>代码示例>>C#>>正文


C# TestMessageLogger.DumpMessages方法代码示例

本文整理汇总了C#中MonoTests.Microsoft.Build.Tasks.TestMessageLogger.DumpMessages方法的典型用法代码示例。如果您正苦于以下问题:C# TestMessageLogger.DumpMessages方法的具体用法?C# TestMessageLogger.DumpMessages怎么用?C# TestMessageLogger.DumpMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoTests.Microsoft.Build.Tasks.TestMessageLogger的用法示例。


在下文中一共展示了TestMessageLogger.DumpMessages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestMSBuildThisProperties

		public void TestMSBuildThisProperties ()
		{
			Engine engine = new Engine (Consts.BinPath);
			Project project = engine.CreateNewProject ();

			string base_dir = Path.GetFullPath (Path.Combine ("Test", "resources")) + Path.DirectorySeparatorChar;
			string tmp_dir = Path.GetFullPath (Path.Combine (base_dir, "tmp")) + Path.DirectorySeparatorChar;

			string first_project = Path.Combine (base_dir, "first.proj");
			string second_project = Path.Combine (tmp_dir, "second.proj");
			string third_project = Path.Combine (tmp_dir, "third.proj");

			string first = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
				<PropertyGroup>
					<FooInMain>$(MSBuildThisFileDirectory)</FooInMain>
				</PropertyGroup>
				<ItemGroup>
					<ItemInMain Include=""$(MSBuildThisFileFullPath)"" />
				</ItemGroup>
				<Import Project=""tmp\second.proj""/>
			</Project>";

			string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
				<PropertyGroup>
					<FooInImport1>$(MSBuildThisFileDirectory)</FooInImport1>
				</PropertyGroup>
				<PropertyGroup>
					<FooInImport2>$(MSBuildThisFileDirectory)</FooInImport2>
				</PropertyGroup>
				<ItemGroup>
					<ItemInImport1 Include=""$(MSBuildThisFileFullPath)"" />
				</ItemGroup>

				<Import Project=""third.proj""/>
			</Project>";

			string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
				<PropertyGroup>
					<FooInTwo>$(MSBuildThisFileFullPath)</FooInTwo>
				</PropertyGroup>
				<ItemGroup>
					<ItemInTwo Include=""$(MSBuildThisFileFullPath)"" />
				</ItemGroup>

				<Target Name=""TargetInTwo"">
					<Message Text=""FooInMain: $(FooInMain)""/>
					<Message Text=""FooInImport1: $(FooInImport1)""/>
					<Message Text=""FooInImport2: $(FooInImport2)""/>
					<Message Text=""FooInTwo: $(FooInTwo)""/>

					<Message Text=""ItemInMain: %(ItemInMain.Identity)""/>
					<Message Text=""ItemInImport1: %(ItemInImport1.Identity)""/>
					<Message Text=""ItemInTwo: %(ItemInTwo.Identity)""/>
					<Message Text=""Full path: $(MSBuildThisFileFullPath)""/>
				</Target>
			</Project>";

			File.WriteAllText (first_project, first);

			Directory.CreateDirectory (Path.Combine (base_dir, "tmp"));
			File.WriteAllText (second_project, second);
			File.WriteAllText (third_project, third);

			MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
				new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
			engine.RegisterLogger (logger);

			project.Load (first_project);
			try {
				Assert.IsTrue (project.Build (), "Build failed");

				logger.CheckLoggedMessageHead ("FooInMain: " + base_dir, "A1");
				logger.CheckLoggedMessageHead ("FooInImport1: " + tmp_dir, "A2");
				logger.CheckLoggedMessageHead ("FooInImport2: " + tmp_dir, "A3");
				logger.CheckLoggedMessageHead ("FooInTwo: " + third_project, "A4");
				logger.CheckLoggedMessageHead ("ItemInMain: " + first_project, "A5");
				logger.CheckLoggedMessageHead ("ItemInImport1: " + second_project, "A6");
				logger.CheckLoggedMessageHead ("ItemInTwo: " + third_project, "A7");
				logger.CheckLoggedMessageHead ("Full path: " + third_project, "A8");

				Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
			} catch {
				logger.DumpMessages ();
				throw;
			} finally {
				File.Delete (first_project);
				File.Delete (second_project);
				File.Delete (third_project);
			}
		}
开发者ID:salloo,项目名称:mono,代码行数:90,代码来源:ProjectTest.cs

示例2: TestTargetReturns

		public void TestTargetReturns ()
		{
			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.Load (Path.Combine ("Test", Path.Combine ("resources", "TestReturns.csproj")));

			var logger = new TestMessageLogger ();
			engine.RegisterLogger (logger);

			bool result = project.Build ("Main");
			if (!result) {
				logger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			logger.CheckLoggedMessageHead ("Result: Bar", "A1");

			Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
		}
开发者ID:ancailliau,项目名称:mono,代码行数:19,代码来源:TargetTest.cs

示例3: TestEmptyPropertyValue

		public void TestEmptyPropertyValue ()
		{
			Engine engine;
			Project project;

			string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<PropertyGroup>
						<A>1</A>
					</PropertyGroup>
					<Target Name='1'>
						<Message Text='Before: $(A)'/>
						<CreateProperty Value=''>
							<Output
								TaskParameter='Value'
								PropertyName='A'
							/>
						</CreateProperty>
						<Message Text='After: $(A)'/>
					</Target>
				</Project>
			";

			engine = new Engine (Consts.BinPath);

			TestMessageLogger testLogger = new TestMessageLogger ();
			engine.RegisterLogger (testLogger);

			project = engine.CreateNewProject ();
			project.LoadXml (documentString);
			if (!project.Build ("1")) {
				testLogger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			testLogger.CheckLoggedMessageHead ("Before: 1", "A1");
			testLogger.CheckLoggedMessageHead ("After: ", "A2");
			Assert.AreEqual (0, testLogger.NormalMessageCount, "Unexpected messages found");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:39,代码来源:CreatePropertyTest.cs

示例4: CreateLogger

		TestMessageLogger CreateLogger (string projectXml)
		{
			var logger = new TestMessageLogger ();
			var result = Build (projectXml, logger);

			if (!result) {
				logger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			return logger;
		}
开发者ID:ancailliau,项目名称:mono,代码行数:12,代码来源:TargetTest.cs

示例5: TestOverridingTargets

		public void TestOverridingTargets ()
		{
			Engine engine;
			Project project;

			string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
				<Target Name='BeforeBuild'/>
				<Target Name='AfterBuild'/>
				<Target Name='Build' DependsOnTargets='BeforeBuild'>
					<Message Text='Build executing'/>
					<CallTarget Targets='AfterBuild'/>
				</Target>
		</Project>";
			using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
				sw.Write (second);
			}

			string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
				<Target Name='AfterBuild'>
					<Message Text='Overriding AfterBuild'/>
				</Target>

				<Import Project='Test/resources/second.proj'/>
				<Target Name='BeforeBuild'>
					<Message Text='Overriding BeforeBuild'/>
				</Target>
		</Project>";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (documentString);

			MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
				new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
			engine.RegisterLogger (logger);

			bool result = project.Build ("Build");
			if (!result) {
				logger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			logger.CheckLoggedMessageHead ("Overriding BeforeBuild", "A1");
			logger.CheckLoggedMessageHead ("Build executing", "A1");

			Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
		}
开发者ID:ancailliau,项目名称:mono,代码行数:47,代码来源:TargetTest.cs

示例6: TestCopy_EmptyDestFolder

		public void TestCopy_EmptyDestFolder () {
			Engine engine;
			Project project;

			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<ItemGroup>
						<SFiles Include='foo.txt'><Md>1</Md></SFiles>
					</ItemGroup>
					<Target Name='1'>
						<Copy SourceFiles='@(SFiles)' DestinationFolder='@(NonExistant)' DestinationFiles='@(NonExistant)' SkipUnchangedFiles='true' >
							<Output TaskParameter='CopiedFiles' ItemName='I0'/>
							<Output TaskParameter='DestinationFiles' ItemName='I1'/>
						</Copy>
					</Target>
				</Project>
			";
			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();

			TestMessageLogger testLogger = new TestMessageLogger ();
			engine.RegisterLogger (testLogger);

			project.LoadXml (documentString);
			if (project.Build ("1")) {
				testLogger.DumpMessages ();
				Assert.Fail ("Build should have failed");
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:29,代码来源:CopyTest.cs

示例7: TestCopy_Retries

		public void TestCopy_Retries ()
		{
			Engine engine;
			Project project;
			string file_path = Path.Combine (source_path, "copyretries.txt");
			string target_file = Path.Combine (target_path, "copyretries.txt");			

			using (File.CreateText (file_path)) { }
			using (File.CreateText (target_file)) { }

			File.SetAttributes (target_file, FileAttributes.ReadOnly);
			Assert.AreEqual (FileAttributes.ReadOnly, File.GetAttributes (target_file), "A1");

			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<PropertyGroup><DestFile>" + target_file + @"</DestFile></PropertyGroup>
					<ItemGroup>
						<SFiles Include='" + file_path + @"'><Md>1</Md></SFiles>
						<DFiles Include='$(DestFile)'><Mde>2</Mde></DFiles>
					</ItemGroup>
					<Target Name='1'>
						<Copy SourceFiles='@(SFiles)' DestinationFiles='@(DFiles)' Retries='3' RetryDelayMilliseconds='2000'>
							<Output TaskParameter='CopiedFiles' ItemName='I0'/>
							<Output TaskParameter='DestinationFiles' ItemName='I1'/>
						</Copy>
						<Message Text=""I0 : @(I0), I1: @(I1)""/>
					</Target>
				</Project>
			";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();

			TestMessageLogger testLogger = new TestMessageLogger ();
			engine.RegisterLogger (testLogger);

			project.LoadXml (documentString);

			// remove the read-only flag from the file after a few secs,
			// so copying works after retries
			new Thread ( () => {
				Thread.Sleep (3000);
				File.SetAttributes (target_file, FileAttributes.Normal);
			}).Start ();

			if (!project.Build ("1")) {
				var sb = new StringBuilder ();
				testLogger.DumpMessages (sb);
				Assert.Fail ("Build failed " + sb.ToString ());
			}

			testLogger.CheckLoggedAny ("Copying failed. Retries left: 3.", MessageImportance.Normal, "A2");
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:53,代码来源:CopyTest.cs

示例8: CheckResourceNames

		void CheckResourceNames (string [,] files, string [] names, string rootNamespace)
		{
			Assert.AreEqual (files.GetUpperBound (0) + 1, names.Length, "Number of files and names must match");
			string projectText = CreateProject (files, rootNamespace);

			Engine engine = new Engine (Consts.BinPath);
			Project project = engine.CreateNewProject ();
			TestMessageLogger logger = new TestMessageLogger ();
			engine.RegisterLogger (logger);
			Console.WriteLine (projectText);
			project.LoadXml (projectText);
			if (!project.Build ("1")) {
				logger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			bool has_targetpaths = files.GetUpperBound (1) == 3;
			BuildItemGroup group = project.GetEvaluatedItemsByName ("ResourceNames");
			Assert.AreEqual (names.Length, group.Count, "A2");
			for (int i = 0; i <= files.GetUpperBound (0); i++) {
				Assert.AreEqual (names [i], group [i].FinalItemSpec, "A3 #" + (i + 1));
				Assert.AreEqual (files [i, 1] != null, group [i].HasMetadata ("LogicalName"), "A4 #" + (i + 1));
				if (files [i, 1] != null)
					Assert.AreEqual (files [i, 1], group [i].GetMetadata ("LogicalName"), "A5 #" + (i + 1));
				Assert.AreEqual (files [i, 2] != null, group [i].HasMetadata ("DependentUpon"), "A6 #" + (i + 1));
				if (files [i, 2] != null)
					Assert.AreEqual (files [i, 2], group [i].GetMetadata ("DependentUpon"), "A7 #" + (i + 1));
				if (has_targetpaths && files [i, 3] != null)
					Assert.AreEqual (files [i, 3], group [i].GetMetadata ("TargetPath"), "A8 #" + (i + 1));
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:31,代码来源:CreateCSharpManifestResourceNameTest.cs

示例9: 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);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:24,代码来源:TaskBatchingTest.cs

示例10: CheckOutput

		void CheckOutput (string[] primary_list, string[] secondary_list, string expected) {
			StringBuilder sb = new StringBuilder ();

			sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + ">");
			sb.Append ("\t<ItemGroup>");
			if (primary_list != null)
				foreach (string s in primary_list)
					sb.AppendFormat ("\t\t<List1 Include=\"{0}\"><Source>List1</Source></List1>", s);

			if (secondary_list != null)
				foreach (string s in secondary_list)
					sb.AppendFormat ("\t\t<List2 Include=\"{0}\"><Source>List2</Source></List2>", s);
			sb.Append ("\t</ItemGroup>");

			sb.Append (@"
					<Target Name='1'>
						<FindAppConfigFile PrimaryList=""@(List1)"" SecondaryList=""@(List2)"" TargetPath=""Foo.exe.config"">
							<Output TaskParameter=""AppConfigFile"" ItemName=""AppConfigWithTargetPath""/>
						</FindAppConfigFile>

						<Message Text=""AppConfigWithTargetPath: %(AppConfigWithTargetPath.Identity) %(AppConfigWithTargetPath.Source) %(AppConfigWithTargetPath.TargetPath)""/>
					</Target>
				</Project>");

			string projectXml = sb.ToString ();
			Engine engine = new Engine (Consts.BinPath);
			TestMessageLogger testLogger = new TestMessageLogger ();
			engine.RegisterLogger (testLogger);

			Project project = engine.CreateNewProject ();
			project.LoadXml (projectXml);
			if (!project.Build ("1")) {
				testLogger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			Assert.AreEqual (1, testLogger.NormalMessageCount, "Expected number of messages");
			testLogger.CheckLoggedMessageHead (expected, "A1");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:39,代码来源:FindAppConfigFileTest.cs

示例11: CreateProjectAndCheck

		void CreateProjectAndCheck (string file, string[] lines, bool overwrite, bool use_overwrite, Action action)
		{
			Engine engine;
			Project project;

			StringBuilder sb = new StringBuilder ();
			sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
	<ItemGroup>
");

			if (lines != null)
				foreach (string line in lines)
					sb.AppendFormat ("\t\t<Lines Include='{0}'/>\n", line);

			sb.AppendFormat (@"</ItemGroup>
					<Target Name='1'>
						<WriteLinesToFile File='{0}' Lines='@(Lines)'", file);

			if (use_overwrite)
				sb.AppendFormat (" Overwrite='{0}' ", overwrite);
			sb.Append (@"/>
					</Target>
				</Project>");

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();

			TestMessageLogger logger = new TestMessageLogger ();
			engine.RegisterLogger (logger);

			project.LoadXml (sb.ToString ());

			try {
				if (!project.Build ("1"))
					Assert.Fail ("Build failed");

				if (action != null)
					action.Invoke ();
			} catch (AssertionException) {
				logger.DumpMessages ();
				Console.WriteLine (sb.ToString ());
				throw;
			} finally {
				File.Delete (file);
			}
		}
开发者ID:psni,项目名称:mono,代码行数:46,代码来源:WriteLinesToFileTest.cs

示例12: CheckProjectForRequiredTests

		Project CheckProjectForRequiredTests (string taskname, string property_arg, bool expected_result, string error_msg,
			string expected_output_msg)
		{
			string projectString = String.Format (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
				<UsingTask TaskName=""{0}"" AssemblyFile=""Test/resources/TestTasks.dll"" />
				<Target Name=""foo"">
					<{0} Property=""{1}"">
						<Output TaskParameter=""Output"" ItemName=""OutItem""/>
					</{0}>
					<Message Text='@(OutItem)'/>
				</Target>
			</Project>", taskname, property_arg);

			Engine engine = new Engine (Consts.BinPath);
			MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
				new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
			engine.RegisterLogger (logger);
			Project project = engine.CreateNewProject ();
			project.LoadXml (projectString);
			try {
				Assert.AreEqual (expected_result, project.Build (), error_msg);
				if (expected_result) {
					logger.CheckLoggedMessageHead (expected_output_msg, "A");
					Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected messages found");
				}
			} catch {
				logger.DumpMessages ();
			}
			return project;
		}
开发者ID:salloo,项目名称:mono,代码行数:30,代码来源:ProjectTest.cs

示例13: TestBuildSolutionProject

		// full solution test
		//[Test]
		public void TestBuildSolutionProject ()
		{
			string basepath = Path.Combine ("Test", Path.Combine ("resources", "Project01"));
			string [] project_dirs = new string [] {
				Path.Combine (basepath, "Lib4"),
				Path.Combine (basepath, "Lib3"),
				Path.Combine (basepath, "Lib2"),
				Path.Combine (basepath, "Lib1"),
				Path.Combine (basepath, "Project01")
			};
			string debug_extn = Consts.RunningOnMono () ? ".dll.mdb" : ".pdb";

			// List of expected output files
			// Lib3
			string [] [] project_files = new string [5][] {
				new string [] { "Lib4.dll", "Lib4" + debug_extn },
				new string [] { "Lib3.dll" , "Lib3" + debug_extn },
				// Lib2
				new string [] {
					"Lib2.dll", "Lib2" + debug_extn,
					"lib2_folder/Lib2.deploy.txt",
					Path.Combine ("fr-CA", "Lib2.resources.dll"),
					Path.Combine ("fr-FR", "Lib2.resources.dll"),
					"Lib4.dll", "Lib4" + debug_extn
				},
				
				// lib1
				new string [] {
					// lib1 files
					"Lib1.dll", "Lib2" + debug_extn,
					"Lib1.deploy.txt",
					Path.Combine ("fr-CA", "Lib1.resources.dll"),
					Path.Combine ("fr-FR", "Lib1.resources.dll"),
					Path.Combine ("en-US", "Lib1.resources.dll"),
					// lib2 files
					"Lib2.dll", "Lib2" + debug_extn,
					"lib2_folder/Lib2.deploy.txt",
					Path.Combine ("fr-CA", "Lib2.resources.dll"),
					Path.Combine ("fr-FR", "Lib2.resources.dll"),
					// lib3 files
					"Lib3.dll", "Lib3" + debug_extn,
					"Lib4.dll", "Lib4" + debug_extn
					},

				new string [] {
					"Project01.exe",
					"Project01" + (Consts.RunningOnMono () ? ".exe.mdb" : ".pdb"),
					// lib1 files
					"Lib1.dll", "Lib1" + debug_extn,
					"Lib1.deploy.txt",
					Path.Combine ("fr-CA", "Lib1.resources.dll"),
					Path.Combine ("fr-FR", "Lib1.resources.dll"),
					Path.Combine ("en-US", "Lib1.resources.dll"),
					// lib2 files
					"Lib2.dll", "Lib2" + debug_extn,
					"lib2_folder/Lib2.deploy.txt",
					Path.Combine ("fr-CA", "Lib2.resources.dll"),
					Path.Combine ("fr-FR", "Lib2.resources.dll"),
					"Lib4.dll", "Lib4" + debug_extn,
					}
			};

			// Cleanup
			for (int i = 0; i < project_dirs.Length; i ++) {
				string bin_path = Path.Combine (project_dirs [i], Path.Combine ("bin", "Debug"));
				string obj_path = Path.Combine (project_dirs [i], Path.Combine ("obj", "Debug"));

				DeleteAllInDir (bin_path);

				DeleteAllInDir (obj_path);
			}

			Engine engine = new Engine (Consts.BinPath);
			MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
				new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
			engine.RegisterLogger (logger);

			engine.GlobalProperties = new BuildPropertyGroup ();
			engine.GlobalProperties.SetProperty ("TreatWarningsAsErrors", "false");

			Project project = engine.CreateNewProject ();
			project.Load (Path.Combine (basepath, "Project01.sln.proj"));
			
			bool result = project.Build ();
			if (!result) {
				logger.DumpMessages ();
				Assert.Fail ("Build failed");
			}

			// We check only the output dir, not the 'obj'
			string debug = Path.Combine ("bin", "Debug");
			for (int i = 0; i < project_dirs.Length; i++) {
				CheckFilesExistInDir (Path.Combine (project_dirs [i], debug),
					project_files [i]);
			}
		}
开发者ID:salloo,项目名称:mono,代码行数:98,代码来源:ProjectTest.cs

示例14: TestCaseSensitivityOfProjectElements

		public void TestCaseSensitivityOfProjectElements ()
		{
			string projectXml = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
        <ItemGroup>
                <Abc Include=""foo"">
                        <MetaDaTA1>md1</MetaDaTA1>
                        <METadata2>md2</METadata2>
                </Abc>
                <Abc Include=""FOO"">
                        <MetaDaTA1>MD1 caps</MetaDaTA1>
                        <METadata2>MD2 caps</METadata2>
                </Abc>
                <Abc Include=""hmm"">
                        <MetaDaTA1>Md1 CAPS</MetaDaTA1>
                        <METadata2>MD2 CAPS</METadata2>
                </Abc>
                <Abc Include=""bar"">
                        <MeTAdata1>md3</MeTAdata1>
                        <Metadata2>md4</Metadata2>
                </Abc>
        </ItemGroup> 
        <PropertyGroup><ProP1>ValueProp</ProP1></PropertyGroup>
	<Target Name=""Main"">
		<MesSAGE Text=""Full item: @(ABC)""/>
		<MEssaGE Text=""metadata1 :%(AbC.MetaDATA1) metadata2: %(ABC.MetaDaTa2)""/>
		<MEssaGE Text=""metadata2 : %(AbC.MetaDAta2)""/>
		<MEssaGE Text=""Abc identity: %(ABC.IDENTitY)""/>
		<MEssaGE Text=""prop1 : $(pROp1)""/>
	</Target>
</Project>
";
			Engine engine = new Engine (Consts.BinPath);
			Project project = engine.CreateNewProject ();
			MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
				new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
			engine.RegisterLogger (logger);

			project.LoadXml (projectXml);
			bool result = project.Build ("Main");
			if (!result) {
				logger.DumpMessages ();
				Assert.Fail ("A1: Build failed");
			}

			logger.CheckLoggedMessageHead ("Full item: foo;FOO;hmm;bar", "#A2");
			logger.CheckLoggedMessageHead ("metadata1 :md1 metadata2: md2", "#A3");
			logger.CheckLoggedMessageHead ("metadata1 :MD1 caps metadata2: MD2 caps", "#A4");
			logger.CheckLoggedMessageHead ("metadata1 :md3 metadata2: md4", "#A5");
			logger.CheckLoggedMessageHead ("metadata2 : md2", "#A6");
			logger.CheckLoggedMessageHead ("metadata2 : MD2 caps", "#A7");
			logger.CheckLoggedMessageHead ("metadata2 : md4", "#A8");
			logger.CheckLoggedMessageHead ("Abc identity: foo", "#A9");
			logger.CheckLoggedMessageHead ("Abc identity: hmm", "#A10");
			logger.CheckLoggedMessageHead ("Abc identity: bar", "#A11");
			logger.CheckLoggedMessageHead ("prop1 : ValueProp", "#A12");

			Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");

		}
开发者ID:salloo,项目名称:mono,代码行数:59,代码来源:ProjectTest.cs

示例15: TestTargetBatching2

		public void TestTargetBatching2 ()
		{
			string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
				<ItemGroup>
					<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
					<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
					<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
					<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>

					<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
					<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>

					<Foo Include=""1_a1""><Md>1</Md></Foo>
					<Foo Include=""2_b1""><Md>2</Md></Foo>
					<Foo Include=""1_c1""><Md>1</Md></Foo>
				</ItemGroup>

				<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
					<Message Text=""TargetStarted""/>
					<Message Text=""List1: @(List1): %(Culture)""/>
					<Message Text=""Foo: @(Foo): %(Md)""/>
				</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");
			}

			CheckLoggedMessagesInOrder (testLogger, new string [] {
				"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
				"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",

				"TargetStarted", "List1: en_b.txt: en",
				"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",

				"TargetStarted", "List1: gb_d.txt: gb",
				"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
			}, "A2");
			CheckEngineEventCounts (testLogger, 3, 3, 12, 12);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:49,代码来源:TaskBatchingTest.cs


注:本文中的MonoTests.Microsoft.Build.Tasks.TestMessageLogger.DumpMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。