public void DifficultyController_UpdatePlayerStatus() { DifficultyController dc = new DifficultyController(validStrings[0].Item1); Assert.AreEqual(1.1, dc.GetPlayerStatus(), "Player status should be 1.1"); Assert.AreEqual(0, dc.GetEndLocationChance(), "Should be no chance of end location"); Assert.AreEqual(0.9d, dc.GetEventModifier(), 0.0001, "Event modifier should be 0.9"); Assert.AreEqual(0, dc.GetPlayerStatusTracker().Count, "Status tracker should be empty"); //Assert.IsTrue(40 / 100 <= dc.GetEventChance() && dc.GetEventChance() <= 80 / 100, "Event chance should be between 40% and 80%"); int statsSum = 300; double invValue = 0.125; double newStatus = (double)statsSum / 400 + invValue; double current = dc.GetPlayerStatus(); double expected = 0.75d * current + (1 - 0.75d) * newStatus; dc.UpdatePlayerStatus(statsSum, invValue); Assert.AreEqual(expected, dc.GetPlayerStatus(), "Player status should be the same as expected"); statsSum = 320; invValue = 0.1; newStatus = (double)statsSum / 400 + invValue; current = dc.GetPlayerStatus(); expected = 0.75d * current + (1 - 0.75d) * newStatus; dc.UpdatePlayerStatus(statsSum, invValue); Assert.AreEqual(expected, dc.GetPlayerStatus(), "Player status should be the same as expected"); }