Пример #1
0
        public void TestCompleteMethodScore()
        {
            this.frame.setIsFrameCompleteLambda((frameNumber, nPlays, score) => score[0] == 10);
            IConsistsOf frame = this.frame;

            Assert.IsFalse(frame.IsComplete());
            frame.Ball(0, 9);
            Assert.IsFalse(frame.IsComplete());
            frame.Ball(0, 1);
            Assert.IsTrue(frame.IsComplete());
        }
Пример #2
0
        public void TestCompleteMethodPlays()
        {
            this.frame.setIsFrameCompleteLambda((frameNumber, nPlays, score) => nPlays == 2);
            IConsistsOf frame = this.frame;  // make a new reference to the frame under test with the type of the interface

            Assert.IsFalse(frame.IsComplete());
            frame.Ball(0, 8);
            Assert.IsFalse(frame.IsComplete());
            frame.Ball(0, 1);
            Assert.IsTrue(frame.IsComplete());
        }
Пример #3
0
        public void TestCompleteMethodframeNumber()
        {
            // This test also tests GetCopy
            // set the completion lambda function for the frame object under test to complete only if it is the 2nd frame of its parent
            this.frame.setIsFrameCompleteLambda((frameNumber, nPlays, score) => frameNumber == 1);
            IConsistsOf frame = this.frame;

            frame.Ball(0, 1);
            Assert.IsFalse(frame.IsComplete());
            frame = frame.GetCopy(1);  // makes a Copy of the Frame with the passed in frameNumber
            Assert.IsFalse(frame.IsComplete());
            frame.Ball(0, 1);          // The child (SinglePlay) must be complete as well as the lambda expression
            Assert.IsTrue(frame.IsComplete());
        }
Пример #4
0
 public void Run()
 {
     // Console.Write(game.ToString());
     // Console.WriteLine();
     // Console.WriteLine(game.GetScore());
     while (!scorerEngine.IsComplete())
     {
         Console.WriteLine(prompt);
         int winner = Convert.ToInt32(Console.ReadLine());
         PlayLambda(winner, scorerEngine);
         // Console.Write(game.ToString());  // enable for debugging
         Console.WriteLine();
         Console.WriteLine(scorecard.GetData());
     }
     Console.WriteLine("GameOver");
     Console.ReadKey();
 }
Пример #5
0
 public bool IsComplete()
 {
     return(downStreamFrame.IsComplete());
 }
Пример #6
0
 bool ITestBowling.IsComplete()
 {
     return(scorerEngine.IsComplete());
 }
Пример #7
0
 bool ITestTennis.IsComplete()
 {
     return(match.IsComplete());
 }
Пример #8
0
 public bool IsComplete()
 {
     return(IsSwitched() ? downStreamFrame2.IsComplete() : downStreamFrame1.IsComplete());
 }