public void NullTraitTest() { TraitStub trait = new TraitStub(); ISchedule schedule = new ScheduleStub(); GameObject gameObject = new GameObject(); TraitStub? retrievedTrait = gameObject.As <TraitStub>(); Assert.IsNull(retrievedTrait); }
public void AddTraitTest() { TraitStub trait = new TraitStub(); ISchedule schedule = new ScheduleStub(); GameObject gameObject = new GameObject(); gameObject.AddTrait(trait); TraitStub?retrievedTrait = gameObject.As <TraitStub>(); Assert.AreEqual(trait, retrievedTrait); }
public void AddTraitToMirrorTest() { TraitStub trait1 = new TraitStub(); FrozenTraitStore traits = new TraitStore() { trait1 } .Freeze(); GameObject gameObject = new GameObject(traits: traits); GameObject gameObject2 = new GameObject(traits: traits); TraitStub2 trait2 = new TraitStub2(); gameObject2.AddTrait(trait2); Assert.That(gameObject.Is <TraitStub>()); Assert.That(!gameObject.Is <TraitStub2>()); Assert.That(gameObject2.Is <TraitStub>()); Assert.That(gameObject2.Is <TraitStub2>()); }