示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testClone() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testClone()
        {
            ModelInstance modelInstance = (new TestModelParser()).EmptyModel;

            Animals animals = modelInstance.newInstance(typeof(Animals));

            modelInstance.DocumentElement = animals;

            Animal animal = modelInstance.newInstance(typeof(Bird));

            animal.Id = "TestId";
            animals.addChildElement(animal);

            ModelInstance cloneInstance = modelInstance.clone();

            getFirstAnimal(cloneInstance).Id = "TestId2";

            assertThat(getFirstAnimal(modelInstance).Id, @is(equalTo("TestId")));
            assertThat(getFirstAnimal(cloneInstance).Id, @is(equalTo("TestId2")));
        }
示例#2
0
        protected internal virtual Animal getFirstAnimal(ModelInstance modelInstance)
        {
            Animals animals = (Animals)modelInstance.DocumentElement;

            return(animals.getAnimals().GetEnumerator().next());
        }