public void SelectPlayerForMatch() { //Setup preconditions var coach = new Coach(); var player = new Player(); //Execute the code to be tested coach.SelectPlayerForMatch(player); //Assert on the expected results Assert.IsTrue(player.IsSelected); Assert.AreEqual(100, player.Happiness); Assert.AreEqual(1, coach.Players.Count); Assert.AreEqual(player, coach.Players.ElementAt(0)); }
public void SelectPlayerForMatch() { //Setup preconditions var coach = new Coach(); var player = new Player(); //Execute the code to be tested coach.SelectPlayerForMatch(player); //Assert on the expected results Assert.IsTrue(player.IsSelected); Assert.AreEqual(100, player.Happiness); Assert.AreEqual(1, coach.Players.Count); Assert.AreEqual(player, coach.Players.ElementAt(0)); }
public void SelectPlayerForMatch() { // Setup preconditions including the setup of mock objects var coach = new Coach(); var playerMock = new Mock <IPlayer>(); //Inject mocked dependencies //Execute the code to be tested coach.SelectPlayerForMatch(playerMock.Object); //Assert on the expected results Assert.AreEqual(1, coach.Players.Count); Assert.AreEqual(playerMock.Object, coach.Players[0]); // Verify that the mock object was called the expected number of times and with the expected parameters playerMock.Verify(x => x.Selected(), Times.Once); }
public void SelectPlayerForMatch() { // Setup preconditions including the setup of mock objects var coach = new Coach(); var playerMock = new Mock<IPlayer>(); //Inject mocked dependencies //Execute the code to be tested coach.SelectPlayerForMatch(playerMock.Object); //Assert on the expected results Assert.AreEqual(1, coach.Players.Count); Assert.AreEqual(playerMock.Object, coach.Players[0]); // Verify that the mock object was called the expected number of times and with the expected parameters playerMock.Verify(x => x.Selected(), Times.Once); }