public void SwitchStates() { var dragon = new Dragon(); dragon.Fly(); Assert.AreEqual(1000, dragon.State.Speed); Assert.IsTrue(dragon.State.Flying); Assert.IsFalse(dragon.State.Walking); dragon.Walk(); Assert.AreEqual(10, dragon.State.Speed); Assert.IsFalse(dragon.State.Flying); Assert.IsTrue(dragon.State.Walking); }
public void WindUpgradeIncreasesWindDamage() { IDragon dragon = new Dragon(); Assert.AreEqual(1, dragon.FireDamage); Assert.AreEqual(1, dragon.WaterDamage); Assert.AreEqual(1, dragon.EarthDamage); Assert.AreEqual(1, dragon.WindDamage); dragon = new DragonWindUpgrade(dragon); Assert.AreEqual(1, dragon.FireDamage); Assert.AreEqual(1, dragon.WaterDamage); Assert.AreEqual(1, dragon.EarthDamage); Assert.AreEqual(11, dragon.WindDamage); }
public void DealDamageDifferentTypes() { var dragon = new Dragon { HitPoints = 1000 }; var human = new Human { HitPoints = 1 }; var projectile = new GigaBlastProjectile(); dragon.Accept(projectile); human.Accept(projectile); Assert.AreEqual(999, dragon.HitPoints); Assert.AreEqual(-1000, human.HitPoints); }
public void DragonFlyPeopleLookUp() { Dragon dragon = new Dragon(); Person p1 = new Person(); Person p2 = new Person(); Person p3 = new Person(); dragon.Subscribe(p1); dragon.Subscribe(p2); dragon.Flying = true; Assert.AreEqual(Person.LookingDirectionTypes.Up, p1.LookingDirection); Assert.AreEqual(Person.LookingDirectionTypes.Up, p2.LookingDirection); Assert.AreEqual(Person.LookingDirectionTypes.Foward, p3.LookingDirection); }
public void ClonedObjectsAreNotSame() { Dragon d1 = new Dragon { Attack = 9000 }; Dragon d2 = d1; Dragon d3 = null; d3 = (Dragon)d1.Clone(); Assert.AreSame(d1, d2); Assert.AreNotSame(d1, d3); Assert.AreEqual(d1.Attack, d3.Attack); d3.Attack = 555; Assert.AreNotEqual(d1.Attack, d3.Attack); }
public void CompositeAttackDealsCompositeDamage() { var d1 = new Dragon(); var d2 = new Dragon(); var d3 = new Dragon(); var d4 = new Dragon(); var d5 = new Dragon(); var composite = new DragonComposite(); composite.Add(d1); composite.Add(d2); composite.Add(d3); composite.Add(d4); Assert.AreEqual(340, composite.Attack()); Assert.AreEqual(100, d5.Attack()); }
public void DragonsMoveAreRecorded() { var dragon = new Dragon(); var dragonRecorder = new Recorder(dragon); dragonRecorder.Record(); Assert.AreEqual(0, dragon.PositionX); Assert.AreEqual(0, dragon.PositionY); dragon.PositionX = 100; dragon.PositionY = 50; dragonRecorder.Record(); Assert.AreEqual(100, dragon.PositionX); Assert.AreEqual(50, dragon.PositionY); dragon.PositionX = 500; dragon.PositionY = 500; dragonRecorder.Record(); Assert.AreEqual(500, dragon.PositionX); Assert.AreEqual(500, dragon.PositionY); dragonRecorder.Rewind(); Assert.AreEqual(100, dragon.PositionX); Assert.AreEqual(50, dragon.PositionY); dragonRecorder.Rewind(); Assert.AreEqual(0, dragon.PositionX); Assert.AreEqual(0, dragon.PositionY); dragonRecorder.Foward(); Assert.AreEqual(100, dragon.PositionX); Assert.AreEqual(50, dragon.PositionY); dragonRecorder.Foward(); Assert.AreEqual(500, dragon.PositionX); Assert.AreEqual(500, dragon.PositionY); }
public void UpgradeStacks() { IDragon dragon = new Dragon(); Assert.AreEqual(1, dragon.FireDamage); Assert.AreEqual(1, dragon.WaterDamage); Assert.AreEqual(1, dragon.EarthDamage); Assert.AreEqual(1, dragon.WindDamage); dragon = new DragonFireUpgrade(dragon); dragon = new DragonFireUpgrade(dragon); dragon = new DragonWaterUpgrade(dragon); dragon = new DragonEarthUpgrade(dragon); dragon = new DragonWindUpgrade(dragon); Assert.AreEqual(21, dragon.FireDamage); Assert.AreEqual(11, dragon.WaterDamage); Assert.AreEqual(11, dragon.EarthDamage); Assert.AreEqual(11, dragon.WindDamage); }
public void DragonsRage() { var dragonsHoardNorth = new DragonMediator(); var dragonsHoardSoulth = new DragonMediator(); var d1 = new Dragon(dragonsHoardNorth); var d2 = new Dragon(dragonsHoardNorth); var d3 = new Dragon(dragonsHoardSoulth); var d4 = new Dragon(dragonsHoardSoulth); d1.DragonsCall(); Assert.AreEqual(100, d1.Rage); Assert.AreEqual(100, d2.Rage); d2.DragonsCall(); Assert.AreEqual(200, d1.Rage); Assert.AreEqual(200, d2.Rage); Assert.AreEqual(0, d3.Rage); Assert.AreEqual(0, d4.Rage); }
public void DragonMoveWalk() { var dragon = new Dragon(); Assert.AreEqual("Walking", dragon.Move(new WalkMoveBridge())); }
public void DragonMoveFly() { var dragon = new Dragon(); Assert.AreEqual("Flying", dragon.Move(new FlyMoveBridge())); }