本文整理汇总了C#中Microsoft.Build.BuildEngine.BuildItem.GetEvaluatedMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# BuildItem.GetEvaluatedMetadata方法的具体用法?C# BuildItem.GetEvaluatedMetadata怎么用?C# BuildItem.GetEvaluatedMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.BuildEngine.BuildItem
的用法示例。
在下文中一共展示了BuildItem.GetEvaluatedMetadata方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructHasMetadata
public void ConstructHasMetadata()
{
BuildItem item = new BuildItem("m", "v");
Assertion.AssertEquals(false, item.HasMetadata("m"));
Assertion.AssertEquals(string.Empty, item.GetEvaluatedMetadata("m"));
Assertion.AssertEquals(string.Empty, item.GetMetadata("m"));
Assertion.AssertEquals(builtInMetadataNames.Length, item.MetadataCount);
Assertion.AssertEquals(0, item.CustomMetadataCount);
}
示例2: TestGetEvaluatedMetadata1
public void TestGetEvaluatedMetadata1 ()
{
string itemName = "a";
string itemInclude = "a";
string metadataName = "name";
string metadataValue = "a;b;c";
item = new BuildItem (itemName, itemInclude);
Assert.AreEqual (String.Empty, item.GetEvaluatedMetadata (metadataName), "A1");
item.SetMetadata (metadataName, metadataValue);
Assert.AreEqual (metadataValue, item.GetEvaluatedMetadata (metadataName), "A2");
Assert.AreEqual (itemInclude, item.GetEvaluatedMetadata ("Identity"), "A3");
}
示例3: TestSetMetadata3
public void TestSetMetadata3 ()
{
item = new BuildItem ("name", "include");
item.SetMetadata ("a", "$(A)");
item.SetMetadata ("b", "$(A)", true);
item.SetMetadata ("c", "$(A)", false);
Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("a"), "A1");
Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("b"), "A2");
Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("c"), "A3");
Assert.AreEqual ("$(A)", item.GetMetadata ("a"), "A4");
Assert.AreEqual (Utilities.Escape ("$(A)"), item.GetMetadata ("b"), "A5");
Assert.AreEqual ("$(A)", item.GetMetadata ("c"), "A6");
}
示例4: TestCopyCustomMetadataTo1
public void TestCopyCustomMetadataTo1 ()
{
BuildItem source, destination;
string itemName1 = "a";
string itemName2 = "b";
string itemInclude = "a;b;c";
string metadataName = "name";
string metadataValue = "value";
source = new BuildItem (itemName1, itemInclude);
destination = new BuildItem (itemName2, itemInclude);
source.SetMetadata (metadataName, metadataValue);
source.CopyCustomMetadataTo (destination);
Assert.AreEqual (metadataValue, destination.GetMetadata (metadataName), "A1");
Assert.AreEqual (metadataValue, destination.GetEvaluatedMetadata (metadataName), "A2");
}
示例5: CheckBuildItem
static void CheckBuildItem (BuildItem item, string name, string [,] metadata, string finalItemSpec, string prefix)
{
Assert.AreEqual (name, item.Name, prefix + "#1");
for (int i = 0; i < metadata.GetLength (0); i++) {
string key = metadata [i, 0];
string val = metadata [i, 1];
Assert.IsTrue (item.HasMetadata (key), String.Format ("{0}#2: Expected metadata '{1}' not found", prefix, key));
Assert.AreEqual (val, item.GetMetadata (key), String.Format ("{0}#3: Value for metadata {1}", prefix, key));
Assert.AreEqual (val, item.GetEvaluatedMetadata (key), String.Format ("{0}#4: Value for evaluated metadata {1}", prefix, key));
}
Assert.AreEqual (finalItemSpec, item.FinalItemSpec, prefix + "#5");
}
示例6: EvaluateMetadata
string EvaluateMetadata (BuildItem it, string metadata)
{
var d = it.GetEvaluatedMetadata (metadata);
if (string.IsNullOrEmpty (d))
return null;
else
return d;
}
示例7: GetEvaluatedMetadata
public override IEnumerable<Tuple<string, string>> GetEvaluatedMetadata(BuildItem proj)
{
return proj.MetadataNames.Cast<string>().Select(k => Tuple.Create(k, proj.GetEvaluatedMetadata(k)));
}
示例8: GetMetadata_EscapedItemSpec
public void GetMetadata_EscapedItemSpec ()
{
string itemInclude = "a;b;c";
string escapedItemInclude = Utilities.Escape (itemInclude);
item = new BuildItem ("name", escapedItemInclude);
Assert.IsTrue (item.GetMetadata ("FullPath").EndsWith (escapedItemInclude), "#1a");
Assert.IsTrue (item.GetEvaluatedMetadata ("FullPath").EndsWith (itemInclude), "#1b");
Assert.AreEqual (escapedItemInclude, item.GetMetadata ("FileName"), "#2b");
Assert.AreEqual (itemInclude, item.GetEvaluatedMetadata ("FileName"), "#2b");
Assert.AreEqual (escapedItemInclude, item.GetMetadata ("Identity"), "#3a");
Assert.AreEqual ("a;b;c", item.GetEvaluatedMetadata ("Identity"), "#3b");
}