public void NextPlayer_CreatePlayers_FurthestAwayNotDoneWillPlay() { //Arrange Indexer.ResetPlayersId(); string sorePlayer; string expectedPlayerName = "Harry"; Golf myGolf = new Golf(); Player myPlayer = new Player(Indexer.NextPlayerId(), "Harry"); myPlayer.LengthToGo = 100; myGolf.AddPlayer(myPlayer); myPlayer = new Player(Indexer.NextPlayerId(), "Barry"); myPlayer.Done = true; myPlayer.LengthToGo = 200; myGolf.AddPlayer(myPlayer); myPlayer = new Player(Indexer.NextPlayerId(), "Jerry"); myPlayer.LengthToGo = 50; myGolf.AddPlayer(myPlayer); //Act sorePlayer = myGolf.NextPlayer().Name; //Assert Assert.Equal(expectedPlayerName, sorePlayer); }
public void NextPlayer_SetupPlayers_LastPlayerLastStrikes() // Invalid by NextPlayer refactoring to "furthest away" { //Arrange string expectedPlayer = "Harry"; Indexer.ResetPlayersId(); Golf myGolfPlay = new Golf(); Player myPlayer = new Player(Indexer.NextPlayerId(), "Harry"); Strike myStrike = new Strike(Indexer.NextStrikeId(), 230); myPlayer.AddStrike(myStrike); myStrike = new Strike(Indexer.NextStrikeId(), 201); myPlayer.AddStrike(myStrike); myGolfPlay.AddPlayer(myPlayer); myPlayer = new Player(Indexer.NextPlayerId(), "Barry"); myStrike = new Strike(Indexer.NextStrikeId(), 130); myPlayer.AddStrike(myStrike); myStrike = new Strike(Indexer.NextStrikeId(), 80); myPlayer.AddStrike(myStrike); myGolfPlay.AddPlayer(myPlayer); myPlayer = new Player(Indexer.NextPlayerId(), "Merry"); myStrike = new Strike(Indexer.NextStrikeId(), 230); myPlayer.AddStrike(myStrike); myStrike = new Strike(Indexer.NextStrikeId(), 145); myPlayer.AddStrike(myStrike); myGolfPlay.AddPlayer(myPlayer); myPlayer = new Player(Indexer.NextPlayerId(), "Cherry"); myStrike = new Strike(Indexer.NextStrikeId(), 218); myPlayer.AddStrike(myStrike); myGolfPlay.AddPlayer(myPlayer); //Act string theNextPLayer = myGolfPlay.NextPlayer().Name; //Assert Assert.Equal(expectedPlayer, theNextPLayer); }
public void NextPlayer_CreateOnePlayer_OnlyPlayerThereWillPlay() { //Arrange Indexer.ResetPlayersId(); string sorePlayer; string expectedPlayerName = "Harry"; Golf myGolf = new Golf(); Player myPlayer = new Player(Indexer.NextPlayerId(), "Harry"); myPlayer.LengthToGo = 100; myGolf.AddPlayer(myPlayer); //Act sorePlayer = myGolf.NextPlayer().Name; //Assert Assert.Matches(expectedPlayerName, sorePlayer); }