예제 #1
0
        public void TestDevCardsContainsReturnsFalseWhenCardIsNotInHand()
        {
            var target = new Hand();

            List<DevelopmentCard> knight = new List<DevelopmentCard>();
            knight.Add(new Knight());
            target.addDevCard(knight);
            Assert.IsFalse(target.devCardsContains("monopoly"));

            List<DevelopmentCard> monopoly = new List<DevelopmentCard>();
            monopoly.Add(new MonopolyCard());
            target.addDevCard(monopoly);
            Assert.IsFalse(target.devCardsContains("victoryPoint"));

            List<DevelopmentCard> victoryPoint = new List<DevelopmentCard>();
            victoryPoint.Add(new VictoryPointCard());
            target.addDevCard(victoryPoint);
            Assert.IsFalse(target.devCardsContains("roadBuilder"));

            List<DevelopmentCard> roadBuilder = new List<DevelopmentCard>();
            roadBuilder.Add(new RoadBuilderCard());
            target.addDevCard(roadBuilder);
            Assert.IsFalse(target.devCardsContains("yearOfPlenty"));

            List<DevelopmentCard> yearOfPlenty = new List<DevelopmentCard>();
            yearOfPlenty.Add(new YearOfPlentyCard());
            target.addDevCard(yearOfPlenty);

            target.removeDevCard("knight");
            Assert.IsFalse(target.devCardsContains("knight"));
        }
 public RemoveCardsForm(Player p, GameScreen gs)
 {
     this.player = p;
     this.gameScreen = gs;
     this.hand = p.getHand();
     InitializeComponent();
     updateLabels();
     updateComboBoxes();
 }
예제 #3
0
        public void TestAddDevCard()
        {
            var target = new Hand();

            List<DevelopmentCard> cards = new List<DevelopmentCard>();
            cards.Add(new Knight());
            cards.Add(new MonopolyCard());
            cards.Add(new VictoryPointCard());
            cards.Add(new RoadBuilderCard());
            cards.Add(new YearOfPlentyCard());

            target.addDevCard(cards);

            Assert.AreEqual(5, target.getDevCardCount());
        }
예제 #4
0
        public void TestDevCardsContains()
        {
            var target = new Hand();

            List<DevelopmentCard> cards = new List<DevelopmentCard>();
            cards.Add(new Knight());
            cards.Add(new MonopolyCard());
            cards.Add(new VictoryPointCard());
            cards.Add(new RoadBuilderCard());
            cards.Add(new YearOfPlentyCard());

            target.addDevCard(cards);

            Assert.AreEqual(5, target.getDevCardCount());

            Assert.IsTrue(target.devCardsContains("knight"));
            Assert.IsTrue(target.devCardsContains("monopoly"));
            Assert.IsTrue(target.devCardsContains("victoryPoint"));
            Assert.IsTrue(target.devCardsContains("roadBuilder"));
            Assert.IsTrue(target.devCardsContains("yearOfPlenty"));
        }
예제 #5
0
 public void testConstructor()
 {
     var hand = new Hand();
     Assert.NotNull(hand);
 }
예제 #6
0
 public void TestThatResourcesGetModified()
 {
     Hand hand = new Hand();
     hand.modifyResources("ore", 3);
     Assert.AreEqual(3, hand.getOre());
     hand.modifyResources("wool", 2);
     Assert.AreEqual(2, hand.getWool());
     hand.modifyResources("lumber", 12);
     Assert.AreEqual(12, hand.getLumber());
     hand.modifyResources("grain", 33);
     Assert.AreEqual(33, hand.getGrain());
     hand.modifyResources("brick", 102);
     Assert.AreEqual(102, hand.getBrick());
 }
예제 #7
0
        public void TestThatHandHasDevelopmentCardResources_Boundary()
        {
            Hand hand = new Hand();

            // At first it does not have sufficient resources
            Assert.False(hand.hasDevCardResources());

            // Now give it the necessary resources
            hand.modifyWool(1);
            hand.modifyGrain(1);
            hand.modifyOre(1);
            Assert.True(hand.hasDevCardResources());
        }
예제 #8
0
 public void TestThatHandHasDevelopmentCardResources_Average()
 {
     Hand hand = new Hand();
     hand.modifyWool(5);
     hand.modifyGrain(5);
     hand.modifyOre(5);
     Assert.True(hand.hasDevCardResources());
 }
예제 #9
0
        public void TestGetResource()
        {
            var target = new Hand();
            target.modifyBrick(2);
            target.modifyGrain(3);
            target.modifyLumber(4);
            target.modifyOre(5);
            target.modifyWool(6);

            Assert.AreEqual(2, target.getResource("brick"));
            Assert.AreEqual(3, target.getResource("grain"));
            Assert.AreEqual(4, target.getResource("lumber"));
            Assert.AreEqual(5, target.getResource("ore"));
            Assert.AreEqual(6, target.getResource("wool"));
        }
예제 #10
0
 public void TestRemoveVictoryPointThrowsWhenPlayerHasNoVictoryPointCards()
 {
     var target = new Hand();
     target.removeDevCard("victoryPoint");
 }
예제 #11
0
 public void TestRemoveRoadBuilderThrowsWhenPlayerHasNoRoadBuilderCards()
 {
     var target = new Hand();
     target.removeDevCard("roadBuilder");
 }
예제 #12
0
 public void TestRemoveMonoplyThrowsWhenPlayerHasNoMonopolyCards()
 {
     var target = new Hand();
     target.removeDevCard("monopoly");
 }
예제 #13
0
 public void TestRemoveKnightThrowsWhenPlayerHasNoKnights()
 {
     var target = new Hand();
     target.removeDevCard("knight");
 }
예제 #14
0
        public void TestIncrementKnightsPlayed()
        {
            var target = new Hand();
            Assert.AreEqual(0, target.getKnights());

            target.incrementKnightsPlayed();
            target.incrementKnightsPlayed();
            Assert.AreEqual(2, target.getKnights());
        }
예제 #15
0
 public void TestGetResourceThrowsOnInvalidString()
 {
     var target = new Hand();
     target.getResource("ice");
 }
예제 #16
0
 public void TestRemoveYearOfPlentyThrowsWhenPlayerHasNoYearOfPlentyCards()
 {
     var target = new Hand();
     target.removeDevCard("yearOfPlenty");
 }
예제 #17
0
 private void dealFromBank(string resource, int amount, Hand hand)
 {
     hand.modifyResources(resource, amount);
     bank.modifyResource(resource, -amount);
 }
예제 #18
0
 public void TestDevCardsContainsReturnsFalseWhenThereAreNoDevCardsInHand()
 {
     var target = new Hand();
     Assert.IsFalse(target.devCardsContains("buffalo"));
 }