public void unmortgaging_property_results_in_correct_balance_alterations() { _residentialProperty = NewResidential(); var testPlayer = GetMeANewPlayer(); var paybackValue = _residentialProperty.GetMortgageValue() + (_residentialProperty.GetMortgageValue() * 10 / 100);// mortgage plus 10% _residentialProperty.SetOwner(ref testPlayer); _residentialProperty.MortgageProperty(); var ownerBalaceBeforeUnmortgage = testPlayer.GetBalance(); var bankerBalanceBeforeUnmortgage = Banker.Access().GetBalance(); _residentialProperty.UnmortgageProperty(); // The property's owner should have paid the mortgage payback value Assert.AreEqual(ownerBalaceBeforeUnmortgage - paybackValue, testPlayer.GetBalance()); // The banker should have received the mortgage payback value Assert.AreEqual(bankerBalanceBeforeUnmortgage + paybackValue, Banker.Access().GetBalance()); }
public void mortgaging_property_results_in_correct_balance_alterations() { _residentialProperty = NewResidential(); var testPlayer = GetMeANewPlayer(); var mortgageValue = _residentialProperty.GetMortgageValue(); var ownerBalanceBefore = testPlayer.GetBalance(); var bankerBalanceBefore = Banker.Access().GetBalance(); _residentialProperty.SetOwner(ref testPlayer); _residentialProperty.MortgageProperty(); // Property should now be mortgaged Assert.IsTrue(_residentialProperty.IsMortgaged); // The property's owner should have received the mortgage money Assert.AreEqual(ownerBalanceBefore + mortgageValue, testPlayer.GetBalance()); // The banker should have paid the mortgage money Assert.AreEqual(bankerBalanceBefore - mortgageValue, Banker.Access().GetBalance()); }