Example #1
0
        public void AddSeedToScoreHouse()
        {
            //ARRANGE:
            IScoreHouse scoreHouse = new MockScoreHouse();
            Player      p          = new Player("boB", scoreHouse);

            //ACT:
            p.AddSeedToScoreHouse(new Seed());
            //ASSERT:
            Assert.AreEqual(1, p.GetScore(), "Should add a seed to the scoreHouse");
        }
Example #2
0
        public void Test2()
        {
            // ARRANGE:
            IScoreHouse k  = new ScoreHouse();
            Player      p1 = new Player("alice", k);
            Player      p2 = new Player("bob", k);

            k = new MockScoreHouse();

            // ACT:
            k.AddSeed(new Seed());
            // ASSERT:
            Assert.AreEqual(1, k.GetCount(), "Score is correct");
        }
Example #3
0
        public void Test2()
        {
            //ARRANGE
            MockScoreHouse oneScore = new MockScoreHouse();
            MockScoreHouse twoScore = new MockScoreHouse();
            Player         one      = new Player("Player 1", oneScore);
            Player         two      = new Player("Player 2", twoScore);
            Board          b        = new Board(one, two);
            //ACT
            Seed seed = new Seed();

            one.AddSeedToScoreHouse(seed);
            //ASSERT
            Assert.AreEqual(1, one.GetScore(), "The score should be one");
        }
Example #4
0
        public void WhenAddSeedToScoreHouseAddSeedIsCalled()
        {
            //arrange
            //IScoreHouse mock = Substitute.For<IScoreHouse>();    //tried using the Nsubstitute package but had errors.
            //mock.AddSeed(Seed seed).Returns(true);
            IScoreHouse mock = new MockScoreHouse();    //create the Mock object
            Player      p1   = new Player("p1", mock);  //create a player object to use the mock object

            //act
            bool test = p1.AddSeedToScoreHouse(new Seed());     //test the player method AddSeedToScoreHouse

            //which calles the mock object method AddSeed(returns true if called).

            //assert
            Assert.AreEqual(true, test);        //check result against mock object return value.
        }