Beispiel #1
0
 public void Run()
 {
     var renderable = new TestRenderable();
     renderer.Add(renderable);
     renderer.Run(null);
     Assert.True(renderable.HasBeenRendered);
 }
        public void Serialization()
        {
            var tr  = new TestRenderable();
            var tr2 = RenderableFactory.Deserialize(RenderableFactory.Serialize(tr).ToString());

            Assert.IsInstanceOfType(tr2, typeof(TestRenderable), "Deserialized result should be an instance of TestRenderable");
        }
        public void GetIndexList()
        {
            var tr = new TestRenderable();

            //
            // Basic Effect Test
            //
            var BasicEffectIndices = tr.GetIndexList(EffectsGlobals.BasicEffectName);

            Assert.IsNotNull(BasicEffectIndices, "BasicEffectIndices list should not be null");
            Assert.IsTrue(BasicEffectIndices.Length > 0, "BasicEffectsIndices list should not be empty");
            Assert.IsInstanceOfType(BasicEffectIndices.ToArray()[0], typeof(uint), "produces uint type for basic effect");

            //
            // Menu Effect Test
            //
            try
            {
                var MenuEffectIndices = tr.GetIndexList(EffectsGlobals.MenuEffectName);
                Assert.Fail("Exception should be thrown when attempting to retrieve menu indices on a TestObject");
            }
            catch (CannotResolveIndicesException crve)
            {
                Assert.AreEqual(EffectsGlobals.MenuEffectName, crve.EffectName, "EffectName given should be MenuEffect when failed on MenuEffect");
                Assert.AreEqual("TestRenderable", crve.RenderableName);
            }

            //
            // Arbirary String Effect Test
            //
            try
            {
                var MenuEffectIndices = tr.GetIndexList("ArbitraryEffect");
                Assert.Fail("Exception should be thrown when attempting to retrieve menu indices on a TestObject");
            }
            catch (CannotResolveIndicesException crve)
            {
                Assert.AreEqual("ArbitraryEffect", crve.EffectName);
                Assert.AreEqual("TestRenderable", crve.RenderableName);
            }
        }
        public void CreateTestRenderable()
        {
            var tr = new TestRenderable();

            Assert.IsNotNull(tr, "is not null");
        }