Ejemplo n.º 1
0
        private bool isPlayersTurn;     // is true when it is player's turn

        // create Player with a name and initialized (empty) score house
        public Player(string name, IScoreHouse s)
        {
            this.scoreHouse = s;
            this.name       = name;
            isPlayersTurn   = false;
            //scoreHouse = new IScoreHouse();
        }
Ejemplo n.º 2
0
        private bool isPlayersTurn;     // is true when it is player's turn

        // create Player with a name and initialized (empty) score house
        public Player(string name, IScoreHouse player)
        {
            this.name     = name;
            isPlayersTurn = false;
            scoreHouse    = player;
            scoreHouse    = new ScoreHouse();
        }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     IScoreHouse[] scoreHouses = new IScoreHouse[2];
     Player        one         = new Player("Player 1", scoreHouses[0]);
     Player        two         = new Player("Player 2", scoreHouses[1]);
     Board         b           = new Board(one, two);
     // rest left as exercise to reader!
 }
Ejemplo n.º 4
0
        public void Test2()
        {
            // ARRANGE:
            IScoreHouse sOne    = new ScoreHouse();
            IScoreHouse mock    = Substitute.For <IScoreHouse>();
            Seed        theSeed = new Seed();

            sOne = mock;
            Player one = new Player("john", sOne);

            // ACT:
            one.AddSeedToScoreHouse(theSeed);
            // ASSERT:
            sOne.Received().AddSeed(theSeed);
        }
Ejemplo n.º 5
0
        public void WhenAddingSeedToScoreHouse()
        {
            //ARRANGE
            IScoreHouse mock    = Substitute.For <IScoreHouse>();
            int         counter = 1;

            mock.When(x => x.AddSeed(new Seed()))
            .Do(x => counter++);

            //ACT

            mock.AddSeed(new Seed());
            mock.AddSeed(new Seed());

            //ASSERT

            Assert.AreEqual(1, counter);
        }
Ejemplo n.º 6
0
        public void TestingAddSeeds()
        {
            //ARRANGE
            IScoreHouse sh   = new ScoreHouse();
            IScoreHouse mock = Substitute.For <IScoreHouse>();
            Seed        s    = new Seed();

            mock.AddSeed(s);
            mock.GetCount().Returns(1);
            sh = mock;
            Player p = new Player("Mock Player", sh);

            //ACT
            p.AddSeedToScoreHouse(s);
            //ASSERT
            Assert.AreEqual(1, sh.GetCount(), "There should be one more seed in ScoreHouse");
            sh.Received().AddSeed(s);
            sh.Received().GetCount();
        }
Ejemplo n.º 7
0
 public Mocking(string v, IScoreHouse h1)
 {
     this.v  = v;
     this.h1 = h1;
 }
Ejemplo n.º 8
0
        private bool isPlayersTurn;     // is true when it is player's turn

        // create Player with a name and initialized (empty) score house
        public Player(string name, IScoreHouse sh)
        {
            this.name       = name;
            isPlayersTurn   = false;
            this.scoreHouse = sh;
        }
Ejemplo n.º 9
0
 public IScoreHouse scoreHouse;  // player's scorehouse
 public mock(string name, IScoreHouse scoreHouse)
 {
     this.name       = name;
     this.scoreHouse = scoreHouse;
     // seedsInHouse = new List<Seed>();
 }