コード例 #1
0
        public void MoveNextWhenHaveInstructionAddedTest()
        {
            InstructionSet instructionSet = new InstructionSet();
            instructionSet.Add("5 5");
            instructionSet.Add("1 2 N");
            instructionSet.Add("L");

            Assert.AreEqual(true, instructionSet.MoveNext());
        }
コード例 #2
0
        public void ResetTest()
        {
            InstructionSet instructionSet = new InstructionSet();
            instructionSet.Add("5 5");
            instructionSet.Add("1 2 N");
            instructionSet.Add("L");
            instructionSet.Add("2 3 W");
            instructionSet.Add("R");

            instructionSet.MoveNext();
            Assert.AreEqual(typeof(HeadingNorth), instructionSet.Current.GetLandingHeading().GetType());

            instructionSet.MoveNext();
            Assert.AreEqual(typeof(HeadingWest), instructionSet.Current.GetLandingHeading().GetType());

            instructionSet.Reset();
            instructionSet.MoveNext();
            Assert.AreEqual(typeof(HeadingNorth), instructionSet.Current.GetLandingHeading().GetType());
        }
コード例 #3
0
 public void MoveNextWhenNoInstructionAddedTest()
 {
     InstructionSet instructionSet = new InstructionSet();
     Assert.AreEqual(false, instructionSet.MoveNext());
 }