示例#1
0
        public void TestMethod1()
        {
            Scorecard scorcard = new Scorecard();

            scorcard.Add("player1", 10);
            scorcard.Add("player2", 15);

            int expectedScore = 15;
            int actualScore   = scorcard["player2"];

            Assert.AreEqual(expectedScore, actualScore);
        }
示例#2
0
        public void Scorecard_Add_LeavesPreviousScoreWhenScoreDecreasesToZero_AndLastDartIsNotDoubleNorInnerBullsEye()
        {
            _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60);
            _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60);

            var scorecard = new Scorecard(120);

            scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object);

            Assert.AreEqual(120, scorecard.Score);
        }
示例#3
0
        public void Scorecard_Add_LeavesPreviousScoreWhenScoreDecreasesToOne()
        {
            _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60);
            _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60);
            _throwResult[2].SetupGet(r => r.TotalPoints).Returns(60);

            var scorecard = new Scorecard(181);

            scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object);

            Assert.AreEqual(181, scorecard.Score);
        }
示例#4
0
        public void Scorecard_Add_LeavesPreviousScoreWhenTotalPointsAreBigger()
        {
            _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60);
            _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60);
            _throwResult[2].SetupGet(r => r.TotalPoints).Returns(60);

            var scorecard = new Scorecard(179);

            scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object);

            Assert.AreEqual(179, scorecard.Score);
        }
示例#5
0
        public void Scorecard_Add_UpdatesScoreWithAllThePoints()
        {
            _throwResult[0].SetupGet(r => r.TotalPoints).Returns(50);
            _throwResult[1].SetupGet(r => r.TotalPoints).Returns(25);
            _throwResult[2].SetupGet(r => r.TotalPoints).Returns(15);

            var scorecard = new Scorecard(150);

            scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object);

            Assert.AreEqual(60, scorecard.Score);
        }
示例#6
0
        public void Scorecard_Add_SetsScoreAsZero_WhenNewScoreIsZero_AndLastDartIsInnerBullseye()
        {
            _throwResult[0].SetupGet(r => r.TotalPoints).Returns(20);
            _throwResult[1].SetupGet(r => r.TotalPoints).Returns(20);
            _throwResult[2].SetupGet(r => r.TotalPoints).Returns(50);
            _throwResult[2].SetupGet(r => r.IsInnerBullseye).Returns(true);

            var scorecard = new Scorecard(90);

            scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object);

            Assert.AreEqual(0, scorecard.Score);
        }