public void GoblinHpBelowZeroResultsInUnActive() { var testBasicFighter = new BasicFighter("TestFighter"); var testGoblin = new Goblin(); Assert.That(testGoblin.IsActive, Is.True); while (testGoblin.CurrentHp > 0) { testBasicFighter.Attack(testGoblin); } Assert.That(testGoblin.IsActive, Is.False); }
public void BasicFighterCanAttack() { //Brittle test, can fail if unlucky with dices var testFighter = new BasicFighter("TestFighter"); var testGoblin = new Goblin(); var hpBefore = testGoblin.CurrentHp; Console.WriteLine($"Initial Hp: {hpBefore}"); for (var i = 0; i < 8; i++) { testFighter.Attack(testGoblin); Console.WriteLine($"Post Attack {i} Hp: {testGoblin.CurrentHp}"); } Assert.That(testGoblin.CurrentHp, Is.LessThan(hpBefore)); }
private void InitGoblins() { var rnd = new Random(); var num = 5; for (var i = 0; i < num; i++) { var gob = new Goblin { Name = "Gerblin " + i, Position = new Vector2((float) rnd.NextDouble()*6f + .6f, (float) rnd.NextDouble()*4f + 1f), ScreenObject = new ScreenObject("Goblin.png", 0, UIElement_OnMouseDown) }; gob.ScreenObject.Image.MouseEnter += Image_MouseEnter; _gm.Register(gob); } }
public void GoblinProperlyInitialized() { var testGoblin = new Goblin(); Assert.That(testGoblin.IsActive, Is.True); }
public void CanCreateGoblin() { Assert.DoesNotThrow(() => { var testGoblin = new Goblin(); }); }