Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testUpdateEggsByReplaceElements()
        public virtual void testUpdateEggsByReplaceElements()
        {
            Egg egg4 = createEgg(modelInstance, "egg4");
            Egg egg5 = createEgg(modelInstance, "egg5");

            egg1.replaceWithElement(egg4);
            egg2.replaceWithElement(egg5);
            assertThat(tweety.Eggs).hasSize(3).containsOnly(egg3, egg4, egg5);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void copyModelInstance()
        public virtual void copyModelInstance()
        {
            modelInstance = cloneModelInstance();
            tweety        = modelInstance.getModelElementById("tweety");
            hedwig        = modelInstance.getModelElementById("hedwig");
            timmy         = modelInstance.getModelElementById("timmy");
            egg1          = modelInstance.getModelElementById("egg1");
            egg2          = modelInstance.getModelElementById("egg2");
            egg3          = modelInstance.getModelElementById("egg3");
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testAddEggsByHelper()
        public virtual void testAddEggsByHelper()
        {
            assertThat(tweety.Eggs).NotEmpty.hasSize(3).containsOnly(egg1, egg2, egg3);

            Egg egg4 = createEgg(modelInstance, "egg4");

            tweety.Eggs.Add(egg4);
            Egg egg5 = createEgg(modelInstance, "egg5");

            tweety.Eggs.Add(egg5);

            assertThat(tweety.Eggs).hasSize(5).containsOnly(egg1, egg2, egg3, egg4, egg5);
        }
Пример #4
0
        public static object[] createModel()
        {
            TestModelParser modelParser   = new TestModelParser();
            ModelInstance   modelInstance = modelParser.EmptyModel;

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

            modelInstance.DocumentElement = animals;

            // add a tns namespace prefix for QName testing
            animals.DomElement.registerNamespace("tns", MODEL_NAMESPACE);

            Bird tweety = createBird(modelInstance, "tweety", Gender.Female);
            Bird hedwig = createBird(modelInstance, "hedwig", Gender.Female);
            Bird timmy  = createBird(modelInstance, "timmy", Gender.Female);
            Egg  egg1   = createEgg(modelInstance, "egg1");

            egg1.Mother = tweety;
            ICollection <Animal> guards = egg1.Guardians;

            guards.Add(hedwig);
            guards.Add(timmy);
            Egg egg2 = createEgg(modelInstance, "egg2");

            egg2.Mother = tweety;
            guards      = egg2.Guardians;
            guards.Add(hedwig);
            guards.Add(timmy);
            Egg egg3 = createEgg(modelInstance, "egg3");

            guards = egg3.Guardians;
            guards.Add(timmy);

            tweety.Spouse = hedwig;
            tweety.Eggs.Add(egg1);
            tweety.Eggs.Add(egg2);
            tweety.Eggs.Add(egg3);

            ICollection <Egg> guardedEggs = hedwig.GuardedEggs;

            guardedEggs.Add(egg1);
            guardedEggs.Add(egg2);

            GuardEgg guardEgg = modelInstance.newInstance(typeof(GuardEgg));

            guardEgg.TextContent = egg1.Id + " " + egg2.Id;
            timmy.GuardedEggRefs.Add(guardEgg);
            timmy.GuardedEggs.Add(egg3);

            return(new object[] { "created", modelInstance, modelParser });
        }