public void CopyMetadataToDoesNotCopyExtension() { TaskItem from = new TaskItem("myfile.txt"); TaskItem to = new TaskItem("myfile.bin"); from.CopyMetadataTo(to); Assertion.AssertEquals(".bin", to.GetMetadata("Extension")); }
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")); }
public void SimpleCopyMetadataTo() { TaskItem from = new TaskItem("myfile.txt"); from.SetMetadata("Culture", "fr"); TaskItem to = new TaskItem("myfile.bin"); from.CopyMetadataTo(to); Assertion.AssertEquals("fr", to.GetMetadata("Culture")); }
public void TestCopyMetadataTo() { item1 = new TaskItem("itemSpec"); item2 = new TaskItem("itemSpec"); item1.SetMetadata("A", "1"); item1.SetMetadata("B", "1"); item1.SetMetadata("C", "1"); item2.SetMetadata("B", "2"); item1.CopyMetadataTo(item2); Assert.AreEqual("1", item2.GetMetadata("A"), "1"); Assert.AreEqual("2", item2.GetMetadata("B"), "2"); Assert.AreEqual("1", item2.GetMetadata("C"), "3"); }
public void CopyMetadataFromITaskItem() { TaskItem from = new TaskItem(); from.ItemSpec = "Monkey.txt"; from.SetMetadata("Dog", "Bingo"); from.SetMetadata("Cat", "Morris"); from.SetMetadata("Bird", "Big"); TaskItem to = new TaskItem(); to.ItemSpec = "Bonobo.txt"; to.SetMetadata("Sponge", "Bob"); to.SetMetadata("Dog", "Harriet"); to.SetMetadata("Cat", "Mike"); from.CopyMetadataTo(to); to.ItemSpec.ShouldBe("Bonobo.txt"); // ItemSpec is never overwritten to.GetMetadata("Sponge").ShouldBe("Bob"); // Metadata not in source are preserved. to.GetMetadata("Dog").ShouldBe("Harriet"); // Metadata present on destination are not overwritten. to.GetMetadata("Cat").ShouldBe("Mike"); to.GetMetadata("Bird").ShouldBe("Big"); }
public void CopyMetadataTo(ITaskItem destinationItem) { item.CopyMetadataTo(destinationItem); }