public void WhenABeeIsFirstCreated_ItIsNotDead() { // Arrange var bee = new TestBee(100, 50); // Assert Assert.IsFalse(bee.IsDead); }
public void WhenCallingToStringOnABeeAndTheBeeIsAlive_TheStringContainsAlive() { // Arrange var bee = new TestBee(50, 50); // Act var beeString = bee.ToString(); // Assert Assert.IsTrue(beeString.Contains("alive")); }
public void WhenCallingToStringOnABee_TheStringContainsItsHealth() { // Arrange var bee = new TestBee(50, 50); // Act var beeString = bee.ToString(); // Assert Assert.IsTrue(beeString.Contains(bee.Health.ToString())); }
public void WhenABeeIsDamagedMoreThanOneHundredPercent_ItsHealthIsZero() { // Arrange var bee = new TestBee(50, 50); // Act bee.Damage(200); // Assert Assert.AreEqual(0, bee.Health); }
public void WhenABeeIsDamagedSlightlyLessThanItsThreshold_ItLives() { // Arrange var threshold = 50; var bee = new TestBee(50, threshold); // Act bee.Damage(threshold - 1); // Assert Assert.IsFalse(bee.IsDead); }
public void WhenCallingToStringOnABee_TheStringContainsItsType() { // Arrange var bee = new TestBee(50, 50); // Act bee.Damage(100); var beeString = bee.ToString(); // Assert Assert.IsTrue(beeString.Contains("TestBee")); }
public void WhenCallingToStringOnABeeAndTheBeeIsDead_TheStringContainsDead() { // Arrange var bee = new TestBee(50, 50); // Act bee.Damage(100); var beeString = bee.ToString(); // Assert Assert.IsTrue(beeString.Contains("dead")); }
public void WhenABeeIsDamagedLessThanZeroPercent_ItsHealthIsUnchanged() { // Arrange var initialHealth = 50; var bee = new TestBee(initialHealth, 50); // Act bee.Damage(-100); // Assert Assert.AreEqual(initialHealth, bee.Health); }
public void WhenABeeIsDamagedSlightlyMoreThanItsThreshold_ItDies() { // Arrange var threshold = 50; var bee = new TestBee(50, threshold); // Act bee.Damage(threshold + 1); // Assert Assert.IsTrue(bee.IsDead); }
public void WhenABeeIsDamagedByFiftyOnePercent_ItsHealthIsReducedToFourtyNinePercent() { // Arrange var initialHealth = 50f; var fourtyNinePercentOfInitialHealth = initialHealth * 0.49; var bee = new TestBee(initialHealth, 50); // Act bee.Damage(51); // Assert Assert.AreEqual(fourtyNinePercentOfInitialHealth, bee.Health); }
public void WhenDamagingABeeTwiceForFiftyPercent_ItsHealthIsReducedToTwentyFivePercent() { // Arrange var initialHealth = 50f; var twentyFivePercentOfInitialHealth = initialHealth * 0.25; var bee = new TestBee(initialHealth, 10); // Act bee.Damage(50); bee.Damage(50); // Assert Assert.AreEqual(twentyFivePercentOfInitialHealth, bee.Health); }
public void WhenDamagingADeadBee_NoFurtherHeathDeductionsAreMadeAndNoErrorIsThrown() { // Arrange var initialHealth = 50f; var bee = new TestBee(initialHealth, 99); // Act bee.Damage(50); var healthAfterFirstDamage = bee.Health; bee.Damage(50); var healthAfterSecondDamage = bee.Health; // Assert Assert.AreEqual(healthAfterFirstDamage, healthAfterSecondDamage); }