Beispiel #1
0
        public MainWindowViewModel()
        {
            _game = new PingPongGame();

            _game.GenerateSets(11);
            _game.Start();
        }
Beispiel #2
0
        public void GameGoToNextShouldMoveCurrentSetToNextSet()
        {
            var game = new PingPongGame();

            game.GenerateSets(7);
            game.Start();

            var expected = 1;
            var actual   = game.CurrentSet.Number;

            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 2;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 3;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 4;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void GameGenerateSetsShouldBeCalledBeforeGameStart()
        {
            var game = new PingPongGame();

            game.Start();
            game.GenerateSets(11);
        }
Beispiel #4
0
        public void GameGoToSetShouldMoveCurrentSetToGivenArgument()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.GoToSet(1);
            var expected = 1;
            var actual   = game.CurrentSet.Number;

            Assert.AreEqual(expected, actual);

            game.GoToSet(2);
            expected = 2;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(4);
            expected = 4;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(8);
            expected = 8;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(1);
            expected = 1;
            actual   = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);
        }
        public void GameGoToNextShouldMoveCurrentSetToNextSet()
        {
            var game = new PingPongGame();

            game.GenerateSets(7);
            game.Start();

            var expected = 1;
            var actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 2;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 3;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToNextSet();
            expected = 4;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);
        }
        public void GameGenerateSetsShouldBeCalledBeforeGameStart()
        {
            var game = new PingPongGame();

            game.Start();
            game.GenerateSets(11);
        }
        public void GameGoToNextSetShouldThrowIfArgumentIsGreaterThanIndexOfLastSet()
        {
            var game = new PingPongGame();

            game.GenerateSets(1);
            game.Start();

            game.GoToNextSet();
        }
Beispiel #8
0
        public void GameGoToNextSetShouldThrowIfArgumentIsGreaterThanIndexOfLastSet()
        {
            var game = new PingPongGame();

            game.GenerateSets(1);
            game.Start();

            game.GoToNextSet();
        }
Beispiel #9
0
        public void GameGoToPreviousShouldThrowIfArgumentIsLesserThanZero()
        {
            var game = new PingPongGame();

            game.GenerateSets(1);
            game.Start();

            game.GoToPreviousSet();
        }
Beispiel #10
0
        public void GameGoToSetShouldThrowIfArgumentIsOutsideOfNumberOfSetsBounds()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.GoToSet(-1);
            game.GoToSet(12);
        }
Beispiel #11
0
        public void GameMarkSetAsFaultForTeamShouldThrowIfArgumentIsNegativeZeroOrGreaterThanTwo()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.MarkSetAsFaultForTeam(-1);
            game.MarkSetAsFaultForTeam(0);
            game.MarkSetAsFaultForTeam(3);
        }
Beispiel #12
0
        public void GameStartSetsStateToStarted()
        {
            var game = new PingPongGame();

            game.Start();

            var expectedState = PingPongGameState.Started;
            var actualState   = game.State;

            Assert.AreEqual(expectedState, actualState);
        }
Beispiel #13
0
        public void GameMarkSetAsPointForTeamShouldMarkCurrentSetAsAPointForAGivenTeam()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.MarkSetAsPointForTeam(1);

            var expected = 1;
            var actual   = game.CurrentSet.ForTeam;

            Assert.AreEqual(expected, actual);
        }
        public void GameGoToSetShouldThrowIfArgumentIsOutsideOfNumberOfSetsBounds()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.GoToSet(-1);
            game.GoToSet(12);
        }
        public void GameGoToPreviousShouldThrowIfArgumentIsLesserThanZero()
        {
            var game = new PingPongGame();

            game.GenerateSets(1);
            game.Start();

            game.GoToPreviousSet();
        }
        public void GameStartSetsStateToStarted()
        {
            var game = new PingPongGame();

            game.Start();

            var expectedState = PingPongGameState.Started;
            var actualState = game.State;

            Assert.AreEqual(expectedState, actualState);
        }
        public void GameMarkSetAsPointForTeamShouldThrowIfArgumentIsNegativeZeroOrGreaterThanTwo()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.MarkSetAsPointForTeam(-1);
            game.MarkSetAsPointForTeam(0);
            game.MarkSetAsPointForTeam(3);
        }
        public void GameMarkSetAsPointForTeamShouldMarkCurrentSetAsAPointForAGivenTeam()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.MarkSetAsPointForTeam(1);

            var expected = 1;
            var actual = game.CurrentSet.ForTeam;

            Assert.AreEqual(expected, actual);
        }
Beispiel #19
0
 public void SetUp()
 {
     _game.GenerateSets(11);
     _game.Start();
 }
        public void GameGoToSetShouldMoveCurrentSetToGivenArgument()
        {
            var game = new PingPongGame();

            game.GenerateSets(11);
            game.Start();

            game.GoToSet(1);
            var expected = 1;
            var actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(2);
            expected = 2;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(4);
            expected = 4;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(8);
            expected = 8;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);

            game.GoToSet(1);
            expected = 1;
            actual = game.CurrentSet.Number;
            Assert.AreEqual(expected, actual);
        }