Пример #1
0
        public void CopyMetadataToDoesNotCopyExtension()
        {
            TaskItem from = new TaskItem("myfile.txt");
            TaskItem to   = new TaskItem("myfile.bin");

            from.CopyMetadataTo(to);

            Assertion.AssertEquals(".bin", to.GetMetadata("Extension"));
        }
Пример #2
0
        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"));
        }
Пример #3
0
        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"));
        }
Пример #4
0
 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");
 }
Пример #5
0
        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");
        }
Пример #6
0
 public void CopyMetadataTo(ITaskItem destinationItem)
 {
     item.CopyMetadataTo(destinationItem);
 }