Exemplo n.º 1
0
 public void TestTradeWoolWithBankThrows()
 {
     var target = new Player();
     target.playerHand.incrementAllResources(4);
     target.tradeWithBank("wool", "grain");
 }
Exemplo n.º 2
0
 public void TestTradeWoolWithBankWithAnythingPort()
 {
     var target = new Player();
     target.incrementCities();
     target.incrementSettlements();
     target.generateWool();
     target.addPort(new Port("Anything", 3));
     target.tradeWithBank("wool", "grain");
     Assert.AreEqual(1, target.playerHand.getGrain());
     Assert.AreEqual(0, target.playerHand.getWool());
 }
Exemplo n.º 3
0
 public void TestTradeWithBankWithOrePort()
 {
     var target = new Player();
     target.incrementCities();
     target.generateWool();
     target.generateOre();
     target.addPort(new Port("Ore", 2));
     target.tradeWithBank("ore", "wool");
     Assert.AreEqual(3, target.playerHand.getWool());
     Assert.AreEqual(0, target.playerHand.getOre());
 }
Exemplo n.º 4
0
 public void TestTradeWithBankWithWoolPort()
 {
     var target = new Player();
     target.incrementCities();
     target.generateGrain();
     target.generateWool();
     target.addPort(new Port("Wool", 2));
     target.tradeWithBank("wool", "grain");
     Assert.AreEqual(3, target.playerHand.getGrain());
     Assert.AreEqual(0, target.playerHand.getWool());
 }
Exemplo n.º 5
0
 public void TestTradeWithBankWithGrainPort()
 {
     var target = new Player();
     target.incrementCities();
     target.generateBrick();
     target.generateGrain();
     target.addPort(new Port("Grain", 2));
     target.tradeWithBank("grain", "brick");
     Assert.AreEqual(3, target.playerHand.getBrick());
     Assert.AreEqual(0, target.playerHand.getGrain());
 }
Exemplo n.º 6
0
 public void TestTradeWithBankWithLumberPort()
 {
     var target = new Player();
     target.incrementCities();
     target.generateOre();
     target.generateLumber();
     target.addPort(new Port("Lumber", 2));
     target.tradeWithBank("lumber", "ore");
     Assert.AreEqual(3, target.playerHand.getOre());
     Assert.AreEqual(0, target.playerHand.getLumber());
 }
Exemplo n.º 7
0
 public void TestTradeWithBankThrowsWoolException()
 {
     var target = new Player();
     target.tradeWithBank("wool", "lumber");
 }
Exemplo n.º 8
0
        public void TestTradeWithBankForOreThrowsWhenBankHasNone()
        {
            World world = new World();
            var player1 = new Player("Bob", Color.Red, world);
            var player2 = new Player("Jim", Color.Blue, world);

            player1.incrementCities();
            player1.incrementCities();

            player2.incrementCities();
            player2.incrementCities();
            player2.incrementCities();
            player2.incrementCities();
            player2.incrementSettlements();

            player2.generateOre();
            player2.incrementSettlements();
            player2.generateOre();

            Assert.AreEqual(0, world.bank.getOreRemaining());

            player1.generateLumber();

            player1.tradeWithBank("lumber", "ore");
        }
Exemplo n.º 9
0
 public void TestTradeWithBankThrowsLumberException()
 {
     var target = new Player();
     target.tradeWithBank("lumber", "grain");
 }
Exemplo n.º 10
0
 public void TestTradeWithBankThrowsOreException()
 {
     var target = new Player();
     target.tradeWithBank("ore", "wool");
 }
Exemplo n.º 11
0
 public void TestTradeWithBankThrowsGrainException()
 {
     var target = new Player();
     target.tradeWithBank("grain", "brick");
 }
Exemplo n.º 12
0
 public void TestTradeWithBankThrowsBrickException()
 {
     var target = new Player();
     target.tradeWithBank("brick", "ore");
 }
Exemplo n.º 13
0
        public void TestTradeWithBankForWoolThrowsWhenBankHasNone()
        {
            World world = new World();
            var player1 = new Player("Bob", Color.Red, world);
            var player2 = new Player("Jim", Color.Blue, world);

            player1.incrementCities();
            player1.incrementCities();

            player2.incrementCities();
            player2.incrementCities();
            player2.incrementCities();
            player2.incrementCities();
            player2.incrementSettlements();

            player2.generateWool();
            player2.incrementSettlements();
            player2.generateWool();

            Assert.AreEqual(0, world.bank.getWoolRemaining());

            player1.generateBrick();

            player1.tradeWithBank("brick", "wool");
        }
Exemplo n.º 14
0
 public void TestTradeBrickWithBankThrows()
 {
     var target = new Player();
     target.playerHand.incrementAllResources(4);
     target.tradeWithBank("brick", "lumber");
 }
Exemplo n.º 15
0
 public void TestTradeWithBankWithBrickPort()
 {
     var target = new Player();
     target.incrementCities();
     target.generateLumber();
     target.generateBrick();
     target.addPort(new Port("Brick", 2));
     target.tradeWithBank("brick", "lumber");
     Assert.AreEqual(3, target.playerHand.getLumber());
     Assert.AreEqual(0, target.playerHand.getBrick());
 }
Exemplo n.º 16
0
 public void TestTradeBrickWithBankWithAnythingPort()
 {
     var target = new Player();
     target.incrementCities();
     target.incrementSettlements();
     target.generateBrick();
     target.addPort(new Port("Anything", 3));
     target.tradeWithBank("brick", "lumber");
     Assert.AreEqual(1, target.playerHand.getLumber());
     Assert.AreEqual(0, target.playerHand.getBrick());
 }
Exemplo n.º 17
0
        public void TestTradeWithBank()
        {
            var target = new Player();

            target.incrementCities();
            target.incrementCities();

            target.generateBrick();
            target.generateGrain();
            target.generateLumber();
            target.generateOre();
            target.generateWool();

            target.tradeWithBank("grain", "brick");
            target.tradeWithBank("lumber", "grain");
            target.tradeWithBank("ore", "lumber");
            target.tradeWithBank("wool", "ore");
            target.tradeWithBank("brick", "wool");

            Assert.AreEqual(1, target.getHand().getGrain());
            Assert.AreEqual(1, target.getHand().getLumber());
            Assert.AreEqual(1, target.getHand().getOre());
            Assert.AreEqual(1, target.getHand().getWool());
            Assert.AreEqual(1, target.getHand().getBrick());
        }