Exemple #1
0
        public void PlayerShouldPayOffMortgageReturnsFalseWhenPlayerDoesNotOwn()
        {
            var car      = new Player("car");
            var property = new FakeProperty(owner: car);

            Assert.IsFalse(mortgageAdvisor.PlayerShouldPayOffMortgage(horse, property));
        }
Exemple #2
0
        public MortgageResult ProcessMortgageTransactions(IPlayer player)
        {
            var properties = GetPropertiesOwnedByPlayer(player);

            var propertiesToMortgage = properties.Where(p => mortgageAdvisor.PlayerShouldMortgageProperty(player, p)).ToList();
            var propertiesToPayOff   = properties.Where(p => mortgageAdvisor.PlayerShouldPayOffMortgage(player, p)).ToList();

            propertiesToMortgage.ForEach(p => mortgageBroker.TakeOutMortgage(player, p));
            propertiesToPayOff.ForEach(p => mortgageBroker.PayOffMortgage(player, p));

            return(new MortgageResult {
                MortgagedProperties = propertiesToMortgage, PaidOffProperties = propertiesToPayOff
            });
        }