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(); }
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(); }
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! }
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); }
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); }
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(); }
public Mocking(string v, IScoreHouse h1) { this.v = v; this.h1 = h1; }
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; }
public IScoreHouse scoreHouse; // player's scorehouse public mock(string name, IScoreHouse scoreHouse) { this.name = name; this.scoreHouse = scoreHouse; // seedsInHouse = new List<Seed>(); }