private static BuildResult CreateBuildResult() { BuildItem buildItem1 = new BuildItem(null, "Item1"); BuildItem buildItem2 = new BuildItem("BuildItem2", "Item2"); BuildItem buildItem3 = BuildItem_Tests.GetXmlBackedItemWithDefinitionLibrary(); // default metadata m=m1 and o=o1 buildItem1.Include = "TestInclude1"; buildItem2.Include = "TestInclude2"; buildItem1.SetMetadata("m", "m1"); buildItem1.SetMetadata("n", "n1"); buildItem3.SetMetadata("n", "n1"); buildItem3.SetMetadata("o", "o2"); BuildItem[] taskItems = new BuildItem[3]; taskItems[0] = buildItem1; taskItems[1] = buildItem2; taskItems[2] = buildItem3; Dictionary <object, object> dictionary = new Dictionary <object, object>(); dictionary.Add("TaskItems", taskItems); BuildResult resultWithOutputs = new BuildResult(dictionary, new Hashtable(StringComparer.OrdinalIgnoreCase), true, 0, 1, 2, true, "Foo", "Fighter", 1, 2, 3); resultWithOutputs.ResultByTarget.Add("ONE", Target.BuildState.CompletedSuccessfully); resultWithOutputs.HandleId = 0; resultWithOutputs.RequestId = 1; return(resultWithOutputs); }
public void CopyMetadataToWithDefaults() { BuildItem fromBuildItem = BuildItem_Tests.GetXmlBackedItemWithDefinitionLibrary(); // i1; has m=m1 (default) and n=n1 (regular) TaskItem from = new TaskItem(fromBuildItem); TaskItem to = new TaskItem("i2"); from.CopyMetadataTo(to); Assertion.AssertEquals("n1", to.GetMetadata("n")); Assertion.AssertEquals("m1", to.GetMetadata("m")); }