public void ScoresSpare_IsSpare()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "3", "/");

            //Act
            // Assert
            Assert.IsTrue(newFrame.IsSpare);
        }
Ejemplo n.º 2
0
        public void ScoresSpare_PassesValidation()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "0", "/");

            //Act
            // Assert
            Assert.IsInstanceOfType(newFrame, typeof(StandardFrame));
            Assert.IsTrue(newFrame.MarkTwo == "/");
        }
        public void ScoresTwoStrikes_ScoresCorrectly()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "X");

            //Act
            var score = newFrame.ScoreFrame("x");

            // Assert
            Assert.AreEqual(20, score);
        }
        public void ScoresOpenFrame_ReturnsCorrectValue()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "7", "1");

            //Act
            var score = newFrame.ScoreFrame();

            // Assert
            Assert.AreEqual(8, score);
        }
        public void ScoresTwoGutters_Returns0()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "0", "0");

            //Act
            var score = newFrame.ScoreFrame();

            // Assert
            Assert.AreEqual(0, score);
        }
        public void ScoresSpare_ThenOpen_ScoresCorrectly()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "8", "/");

            //Act
            var score = newFrame.ScoreFrame("7");

            // Assert
            Assert.AreEqual(17, score);
        }
        public void ScoresStrikeThenOpen_ScoresCorrectly()
        {
            // Arrange
            var newFrame = new StandardFrame(0, _acceptableMarks, "X");

            //Act
            var score = newFrame.ScoreFrame("7", "2");

            // Assert
            Assert.AreEqual(19, score);
        }
        public void ScoresOpenFrame_CannotBeMoreThan9()
        {
            // Arrange
            var       newFrame          = new StandardFrame(0, _acceptableMarks, "7", "3");
            Exception expectedException = null;

            //Act
            try
            {
                newFrame.ScoreFrame();
            }
            catch (ApplicationException ex)
            {
                expectedException = ex;
            }

            // Assert
            Assert.IsNotNull(expectedException);
        }
        public void ScoresSpare_ThenSpare_ThrowsException()
        {
            // Arrange
            Exception expectedException = null;
            var       newFrame          = new StandardFrame(0, _acceptableMarks, "0", "/");

            //Act
            try
            {
                var score = newFrame.ScoreFrame("/", "X");
            }
            catch (ApplicationException ex)
            {
                expectedException = ex;
            }

            // Assert
            Assert.IsNotNull(expectedException);
        }
Ejemplo n.º 10
0
        public void FirstMarkIsSpare_ThrowsArgumentException()
        {
            // Arrange
            Exception expectedException = null;
            var       newFrame          = new StandardFrame(0, _acceptableMarks, "/");

            //Act
            try
            {
                newFrame.ValidateInput();
            }
            catch (ArgumentException ex)
            {
                expectedException = ex;
            }

            // Assert
            Assert.IsNotNull(expectedException);
        }
Ejemplo n.º 11
0
        public void InvalidSecondMarkAfterStrike_ThrowsArgumentException()
        {
            // Arrange
            Exception expectedException = null;
            var       newFrame          = new StandardFrame(0, _acceptableMarks, "X", "1");

            //Act
            try
            {
                newFrame.ValidateInput();
            }
            catch (ArgumentException ex)
            {
                expectedException = ex;
            }

            // Assert
            Assert.IsNotNull(expectedException);
        }