//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testAddGuardedEggRefsByHelper() public virtual void testAddGuardedEggRefsByHelper() { assertThat(hedwig.GuardedEggRefs).NotEmpty.hasSize(2); GuardEgg egg3GuardedEgg = modelInstance.newInstance(typeof(GuardEgg)); egg3GuardedEgg.TextContent = egg3.Id; hedwig.GuardedEggRefs.Add(egg3GuardedEgg); assertThat(hedwig.GuardedEggRefs).NotEmpty.hasSize(3).contains(egg3GuardedEgg); }
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 }); }