Ejemplo n.º 1
0
        public void TestDeuceAfterAdvantageBis()
        {
            ServiceMatch       target = new ServiceMatch();
            List <IMatchEvent> events = new List <IMatchEvent>()
            {
                new MatchStarted("p1", "p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2")
            };

            Match actual = target.Replay(events);

            Assert.AreEqual(actual.Score[0], 3);
            Assert.AreEqual(actual.Score[1], 3);
            Assert.AreEqual(actual.Deuce, true);
            Assert.AreEqual(actual.AdvantagePlayer, string.Empty);
        }
Ejemplo n.º 2
0
        public void TestGameAfterOneDeuceAdvantage()
        {
            ServiceMatch       target = new ServiceMatch();
            List <IMatchEvent> events = new List <IMatchEvent>()
            {
                new MatchStarted("p1", "p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p1")
            };

            Match actual = target.Replay(events);

            Assert.AreEqual(actual.Score[0], 0);
            Assert.AreEqual(actual.Score[1], 0);
            Assert.AreEqual(actual.Score[2], 1);
            Assert.AreEqual(actual.Score[3], 0);
        }
Ejemplo n.º 3
0
        public void TestMatchStart()
        {
            ServiceMatch       target = new ServiceMatch();
            List <IMatchEvent> events = new List <IMatchEvent>()
            {
                new MatchStarted("p1", "p2"),
            };

            Match actual = target.Replay(events);
        }
Ejemplo n.º 4
0
        public void TestPoint()
        {
            ServiceMatch       target = new ServiceMatch();
            List <IMatchEvent> events = new List <IMatchEvent>()
            {
                new MatchStarted("p1", "p2"),
                new MatchPoint("p1"),
            };

            Match actual = target.Replay(events);

            Assert.AreEqual(actual.Score[0], 1);
            Assert.AreEqual(actual.Score[1], 0);
        }
Ejemplo n.º 5
0
        public void TestAdvantage()
        {
            ServiceMatch       target = new ServiceMatch();
            List <IMatchEvent> events = new List <IMatchEvent>()
            {
                new MatchStarted("p1", "p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1"),
                new MatchPoint("p2"),
                new MatchPoint("p1")
            };

            Match actual = target.Replay(events);

            Assert.AreEqual(actual.Score[0], 3);
            Assert.AreEqual(actual.Score[1], 3);
            Assert.AreEqual(actual.Deuce, false);
            Assert.AreEqual(actual.AdvantagePlayer, "p1");
        }