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

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

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