예제 #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());
        }
예제 #2
0
 public void Setup()
 {
     playMatch = new Mock<IPlayMatch>();
     playMatches = new List<IPlayMatch>();
     playMatches.Add(playMatch.Object);
     target = new PlayTournament(playMatches);
 }
예제 #3
0
 public void Setup()
 {
     playMatch   = new Mock <IPlayMatch>();
     playMatches = new List <IPlayMatch>();
     playMatches.Add(playMatch.Object);
     target = new PlayTournament(playMatches);
 }
예제 #4
0
        public void Constructor_Empty_Sides_Contract_Checked()
        {
            //Arrange
            var matches = new List<IPlayMatch>();

            //Act
            target = new PlayTournament(matches);
        }
예제 #5
0
        public void Constructor_Empty_Sides_Contract_Checked()
        {
            //Arrange
            var matches = new List <IPlayMatch>();

            //Act
            target = new PlayTournament(matches);
        }
예제 #6
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());
        }
예제 #7
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());
        }
예제 #8
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());
        }
예제 #9
0
 public void TearDown()
 {
     playMatch.VerifyAll();
     target = null;
 }
예제 #10
0
 public void TearDown()
 {
     playMatch.VerifyAll();
     target = null;
 }
예제 #11
0
 public void Constructor_Null_Sides_Contract_Checked()
 {
     //Act
     target = new PlayTournament(null);
 }
예제 #12
0
 public void Constructor_Null_Sides_Contract_Checked()
 {
     //Act
     target = new PlayTournament(null);
 }