コード例 #1
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));
        }
コード例 #2
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));
        }
コード例 #3
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);
        }
コード例 #4
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);
        }