コード例 #1
0
 public void Copy(IUriExtent source, IUriExtent target)
 {
     var copier = new ObjectCopier(_factory);
     foreach (var element in source.elements())
     {
         var elementAsElement = element as IElement;
         var copiedElement = copier.Copy(elementAsElement);
         target.elements().add(copiedElement);
     }
 }
コード例 #2
0
        public void TestCopyOfObject()
        {
            var factory = new MofFactory();

            var mofObject = new MofElement();
            mofObject.set(property1, "55130");
            mofObject.set(property2, "Mainz");

            var mofObject2 = new MofElement();
            mofObject2.set(property1, "65474");
            mofObject2.set(property2, "Bischofsheim");

            var copier = new ObjectCopier(factory);
            var result1 = copier.Copy(mofObject);
            var result2 = copier.Copy(mofObject2);

            Assert.That(result1, Is.Not.Null);
            Assert.That(result1.get(property1).ToString(), Is.EqualTo("55130"));
            Assert.That(result1.get(property2).ToString(), Is.EqualTo("Mainz"));
            Assert.That(result2.get(property1).ToString(), Is.EqualTo("65474"));
            Assert.That(result2.get(property2).ToString(), Is.EqualTo("Bischofsheim"));
        }