コード例 #1
0
        public void ReadInitialPosition_ReturnsCleaningProgramWithCorrectPosition()
        {
            Location expectedPosition = new Location(20, 10);
            InstructionsReader reader = new InstructionsReader();
            reader.ReadInitialPosition("20 10");

            var cleaningProgram = reader.BuildCleaningProgram();

            Assert.AreEqual(cleaningProgram.InitialPosition, expectedPosition);
        }
コード例 #2
0
        public void ReadCleaningInstructions_BuildsCorrectCleaningProgram()
        {
            const Direction expectedInstructionDirection = Direction.North;
            const int expectedInstructionSteps = 99999;
            const int expectedMoveInstructions = 1;
            Location expectedInitialPosition = new Location(10, 20);
            InstructionsReader reader = new InstructionsReader();
            reader.ReadInitialPosition("10 20");
            reader.ReadMoveInstruction("N 99999");

            var cleaningProgram = reader.BuildCleaningProgram();

            Assert.AreEqual(expectedInitialPosition, cleaningProgram.InitialPosition);
            Assert.AreEqual(expectedMoveInstructions, cleaningProgram.MoveInstructions.Count);
            Assert.AreEqual(expectedInstructionDirection, cleaningProgram.MoveInstructions[0].Direction);
            Assert.AreEqual(expectedInstructionSteps, cleaningProgram.MoveInstructions[0].Steps);
        }