コード例 #1
0
 public void TestTradeWoolWithBankThrows()
 {
     var target = new Player();
     target.playerHand.incrementAllResources(4);
     target.tradeWithBank("wool", "grain");
 }
コード例 #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());
 }
コード例 #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());
 }
コード例 #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());
 }
コード例 #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());
 }
コード例 #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());
 }
コード例 #7
0
 public void TestTradeWithBankThrowsWoolException()
 {
     var target = new Player();
     target.tradeWithBank("wool", "lumber");
 }
コード例 #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");
        }
コード例 #9
0
 public void TestTradeWithBankThrowsLumberException()
 {
     var target = new Player();
     target.tradeWithBank("lumber", "grain");
 }
コード例 #10
0
 public void TestTradeWithBankThrowsOreException()
 {
     var target = new Player();
     target.tradeWithBank("ore", "wool");
 }
コード例 #11
0
 public void TestTradeWithBankThrowsGrainException()
 {
     var target = new Player();
     target.tradeWithBank("grain", "brick");
 }
コード例 #12
0
 public void TestTradeWithBankThrowsBrickException()
 {
     var target = new Player();
     target.tradeWithBank("brick", "ore");
 }
コード例 #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");
        }
コード例 #14
0
 public void TestTradeBrickWithBankThrows()
 {
     var target = new Player();
     target.playerHand.incrementAllResources(4);
     target.tradeWithBank("brick", "lumber");
 }
コード例 #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());
 }
コード例 #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());
 }
コード例 #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());
        }