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); }
public UnitTestUpdater(SpriteWrapper sw) : base(sw) { _id = Guid.NewGuid(); }
/// <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; }
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); } }
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."); }
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); } }