public void GetAllPlayers_List()
        {
            //Arrange
            var expectedPlayerList = new List <Player> {
                new Player("Pravin", 0, false, 0, new List <int> {
                    5, 30, 25, 10, 15, 01, 09, 05
                }),
                new Player("Irfan", 0, false, 0, new List <int> {
                    5, 30, 25, 10, 15, 01, 09, 05
                }),
                new Player("Jalindar", 0, false, 0, new List <int> {
                    5, 30, 25, 10, 15, 01, 09, 05
                }),
                new Player("Vaishali", 0, false, 0, new List <int> {
                    5, 30, 25, 10, 15, 01, 09, 05
                }),
            };

            //Act
            _playersMock.Setup(x => x.getPlayersList()).Returns(expectedPlayerList);
            _playersMock.Setup(x => x.getPlayersOnStrike(expectedPlayerList, 0)).Returns(expectedPlayerList.Take(2).ToList());

            _cricket.BeginTheMatch();

            //Assert
            _playersMock.Verify(v => v.getPlayersList(), Times.AtLeastOnce);
            _playersMock.Verify(v => v.getPlayersOnStrike(expectedPlayerList, 0), Times.AtLeastOnce);
        }
Esempio n. 2
0
        public void Validate_WithZeroTargetRun_ThrowsException()
        {
            //Arrange
            var playerList = new List <Player> {
                new Player("Carmel", 0, false, 0, new List <int> {
                    5, 30, 25, 10, 15, 01, 09, 05
                })
            };
            var cricketWithoutOver = new CricketMatch(0, 40, _playersMock.Object, _commentaryMock.Object, _weightedRandomGeneratorMock.Object);

            //Act
            _playersMock.Setup(x => x.getPlayersList()).Returns(playerList);
            cricketWithoutOver.BeginTheMatch();
        }
Esempio n. 3
0
 public void ValidatePlayers_WithZeroCount_ThrowsException()
 {
     //Arragne
     _playersMock.Setup(x => x.getPlayersList()).Returns(new List <Player>());
     _cricket.BeginTheMatch();
 }