public void TestTrainStationFieldBuyInAuction() { Game game = new Game(new Player[] { new Player("XXX"), new Player("YYY") }); TrainstationField field5 = ((TrainstationField)game.Fields[5]); field5.BuyInAuction(game.Players[0], 20); Assert.That(game.Players[0].OwnerShip[0].Name, Is.EqualTo(FieldNames.KingsCrossStation)); Assert.That(game.Players[0].Money, Is.EqualTo(1500 - 20)); }
private static void DisplayTrainStationFieldData(Game game, int pos) { TrainstationField streetField = (TrainstationField)game.Fields[pos]; Console.Write(streetField.Name + ", Mortage: " + streetField.IsMortage + ", RentToPay: " + streetField.RentToPay); if (streetField.Owner != null) { Console.Write(", Owner: " + streetField.Owner.Name); } }
public void TestExChangeTrainStationFieldwithField() { Game game = new Game(new Player[] { new Player("XXX"), new Player("YYY") }); StreetField field1 = ((StreetField)game.Fields[1]); TrainstationField field5 = ((TrainstationField)game.Fields[5]); field1.Buy(game.Players[0]); field5.Buy(game.Players[1]); field5.ExchangeField(field5.Owner, game.Players[0], field1); Assert.That(field1.Owner.Name, Is.EqualTo(game.Players[1].Name)); Assert.That(field5.Owner.Name, Is.EqualTo(game.Players[0].Name)); }
public void TestTrainStationField() { Game game = new Game(new Player[] { new Player("XXX"), new Player("YYY") }); TrainstationField field5 = ((TrainstationField)game.Fields[5]); TrainstationField field6 = ((TrainstationField)game.Fields[6]); field5.Buy(game.Players[0]); field6.Buy(game.Players[0]); Assert.That(() => field5.Buy(game.Players[0]), Throws.InvalidOperationException); game.SetPlayerPos(game.Players[1], 5); Assert.That(game.Players[1].Money, Is.EqualTo(1500 - 50)); Assert.That(() => field5.SetRentToPay(100), Throws.ArgumentException); }
public void TestExChangeTrainStationFieldMoney() { Game game = new Game(new Player[] { new Player("XXX"), new Player("YYY") }); TrainstationField field5 = ((TrainstationField)game.Fields[5]); field5.Buy(game.Players[0]); field5.ExchangeField(game.Players[0], game.Players[1], 60); Assert.That(game.Players[0].OwnerShip.Count(), Is.EqualTo(0)); Assert.That(game.Players[0].Money, Is.EqualTo(1500 - 200 + 60)); Assert.That(game.Players[1].OwnerShip[0].Name, Is.EqualTo(FieldNames.KingsCrossStation)); Assert.That(game.Players[1].Money, Is.EqualTo(1440)); Assert.That(field5.Owner.Name, Is.EqualTo(game.Players[1].Name)); }
public void TestPayOffMortageTrainStation() { Game game = new Game(new Player[] { new Player("XXX"), new Player("YYY") }); TrainstationField field5 = ((TrainstationField)game.Fields[5]); TrainstationField field6 = ((TrainstationField)game.Fields[6]); field5.Buy(game.Players[0]); field5.TakeMortage(game.Players[0]); Assert.That(field5.IsMortage, Is.EqualTo(true)); field5.PayOffMortage(game.Players[0]); Assert.That(field5.IsMortage, Is.EqualTo(false)); Assert.That(game.Players[0].Money, Is.EqualTo(1500 - 200 + 100 - 110)); Assert.That(() => field5.PayOffMortage(game.Players[1]), Throws.InvalidOperationException); field6.Buy(game.Players[0]); Assert.That(() => field5.PayOffMortage(game.Players[0]), Throws.InvalidOperationException); }