Example #1
0
        public void Play_4_Sides_Winner_Determined()
        {
            //Arrange
            var anotherMatch = new Mock <IPlayMatch>();

            playMatches.Add(anotherMatch.Object);

            target = new PlayTournament(playMatches);

            var winner = new Mock <ISide>();

            winner.SetupProperty <int>(w => w.Strength, 33);

            playMatch.Setup <ISide>(m => m.Play()).Returns(winner.Object);
            anotherMatch.Setup <ISide>(m => m.Play()).Returns(winner.Object);

            //Act
            ISide result = target.Play();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(winner.Object, result);
            playMatch.Verify(m => m.Play(), Times.Exactly(1));
            Assert.AreEqual(3, target.GetMatchScores().Count());
        }
Example #2
0
        public void Play_2_Sides_Winner_Determined()
        {
            //Arrange
            target = new PlayTournament(playMatches);
            var winner = new Mock<ISide>();
            playMatch.Setup<ISide>(m => m.Play()).Returns(winner.Object);

            //Act
            var result = target.Play();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(winner.Object, result);
            playMatch.Verify(m => m.Play(), Times.AtMostOnce());
            Assert.AreEqual(1, target.GetMatchScores().Count());
        }
Example #3
0
        public void Play_2_Sides_Winner_Determined()
        {
            //Arrange
            target = new PlayTournament(playMatches);
            var winner = new Mock <ISide>();

            playMatch.Setup <ISide>(m => m.Play()).Returns(winner.Object);

            //Act
            var result = target.Play();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(winner.Object, result);
            playMatch.Verify(m => m.Play(), Times.AtMostOnce());
            Assert.AreEqual(1, target.GetMatchScores().Count());
        }
Example #4
0
        public void Play_4_Sides_Winner_Determined()
        {
            //Arrange
            var anotherMatch = new Mock<IPlayMatch>();
            playMatches.Add(anotherMatch.Object);

            target = new PlayTournament(playMatches);

            var winner = new Mock<ISide>();
            winner.SetupProperty<int>(w => w.Strength, 33);

            playMatch.Setup<ISide>(m => m.Play()).Returns(winner.Object);
            anotherMatch.Setup<ISide>(m => m.Play()).Returns(winner.Object);

            //Act
            ISide result = target.Play();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(winner.Object, result);
            playMatch.Verify(m => m.Play(), Times.Exactly(1));
            Assert.AreEqual(3, target.GetMatchScores().Count());
        }