Exemplo n.º 1
0
        public void NullTraitTest()
        {
            TraitStub  trait          = new TraitStub();
            ISchedule  schedule       = new ScheduleStub();
            GameObject gameObject     = new GameObject();
            TraitStub? retrievedTrait = gameObject.As <TraitStub>();

            Assert.IsNull(retrievedTrait);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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>());
        }