public void TestSetByDerived() { NamedObjectSave nos = mDerivedEntity.NamedObjects.FirstOrDefault(item => item.FieldName == "SpriteInstance"); bool shouldCreate = ElementRuntime.ShouldElementRuntimeBeCreatedForNos(nos, mDerivedEntity); if (!shouldCreate) { throw new Exception("NOS's which are defined by base, but their base has SetByDerived should be created."); } if (mDerivedElementRuntime.ContainedElements.FirstOrDefault(item => item.Name == "SpriteInstance") == null) { throw new Exception("Objects defined in base and SetByDerived should be created, but are not."); } // Verify that only 1 AARect has been made int count = 0; foreach (var item in mDerivedElementRuntime.ContainedElements.Where(item => item.Name == "RectInstance")) { count++; } if (count != 1) { throw new Exception("Only one rectangle should be created, but it looks like more are made"); } }