Ejemplo n.º 1
0
        public void SpriteWrapperConstructorTest()
        {
            ICollection<ISprite> spritestart = new ISprite[3]; // TODO: Initialize to an appropriate value
            SpriteBatch sb = MockedSB; // TODO: Initialize to an appropriate value
            Updater updates = new UnitTestUpdater(null); // TODO: Initialize to an appropriate value
            SpriteWrapper target = new SpriteWrapper(spritestart, sb, updates);
            Assert.AreEqual<Updater>(updates, target.Updater);

            Assert.AreEqual(spritestart.Count, target.Sprites.Count);
        }
Ejemplo n.º 2
0
 public UnitTestUpdater(SpriteWrapper sw)
     : base(sw)
 {
     _id = Guid.NewGuid();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Construct a new Updater associated with this SpriteWrapper.
 /// </summary>
 /// <param name="sw">The SpriteWrapper to associate this Updater with.</param>
 public Updater(SpriteWrapper sw)
 {
     _sw = sw;
 }
Ejemplo n.º 4
0
        public void UpdaterTest()
        {
            SpriteBatch sb = MockedSB;
            UnitTestSprite[] spritestart = new UnitTestSprite[25];

            //Initialize array
            for (int i = 0; i < spritestart.Length; i++)
            {
                spritestart[i] = new UnitTestSprite();
                Assert.IsFalse(spritestart[i].IsUpdated);
                Assert.IsFalse(spritestart[i].IsDrawn);
            }
            SpriteWrapper target = new SpriteWrapper(sb, spritestart);
            UnitTestUpdater updater = new UnitTestUpdater(target);
            target.Updater = updater;
            Assert.AreEqual(target.Sprites, updater.AllSprites);
            target.Update();
            Assert.AreEqual(updater.UpdatedSprites, spritestart.Length);
            for (int i = 0; i < spritestart.Length; i++)
            {
                Assert.IsTrue(spritestart[i].IsUpdated);
                Assert.IsFalse(spritestart[i].IsDrawn);
            }
        }
Ejemplo n.º 5
0
        public void SpriteWrapperConstructorTest1()
        {
            SpriteBatch sb = null;
            ISprite[] spritestart = null;
            SpriteWrapper target = null;
            try
            {
                target = new SpriteWrapper(sb, spritestart);
            }
            catch (ArgumentNullException) { }

            Assert.IsNull(target, "The target constructor did not throw an ArgumentNullException when it should have.");
        }
Ejemplo n.º 6
0
        public void UpdateTest()
        {
            //SpriteBatch sb = new SpriteBatch(new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, new PresentationParameters() { DeviceWindowHandle = GraphicsAdapter.DefaultAdapter.MonitorHandle } ));
            SpriteBatch sb = MockedSB;
            UnitTestSprite[] spritestart = new UnitTestSprite[25];

            //Initialize array
            for (int i = 0; i < spritestart.Length; i++)
            {
                spritestart[i] = new UnitTestSprite();
                Assert.IsFalse(spritestart[i].IsUpdated);
                Assert.IsFalse(spritestart[i].IsDrawn);
            }
            SpriteWrapper target = new SpriteWrapper(sb, spritestart);
            target.Update();
            Assert.IsNull(target.Updater);
            for (int i = 0; i < spritestart.Length; i++)
            {
                Assert.IsTrue(spritestart[i].IsUpdated);
                Assert.IsFalse(spritestart[i].IsDrawn);
            }
        }