Exemplo n.º 1
0
        public string ExecuteExplorationPlan(string input)
        {
            if (_explorationPlanDeserializer == null)
            {
                throw new ArgumentNullException("explorationPlanDeserializer");
            }

            if (_finalStatusSerializer == null)
            {
                throw new ArgumentNullException("finalStatusSerializer");
            }

            ExplorationPlan explorationPlan = _explorationPlanDeserializer.DeserializeExplorationPlan(input);

            FinalStatus finalStatus = this.ExecuteExplorationPlan(explorationPlan);

            string output = _finalStatusSerializer.SerializeFinalStatus(finalStatus);

            return(output);
        }
        public void ExplorationPlanDeserializer_DeserializeExplorationPlanWithInvalidArgument_ThrowsInputInvalidLineCountException()
        {
            string testInput = "5 5\n" +
                               "1 2 N\n" +
                               "LMLMLMLMM\n" +
                               "3 3 E\n";

            // the series of instructions of the second rover is missing.

            Assert.Throws <InputInvalidLineCountException>(() => { ExplorationPlan explorationPlan = _explorationPlanDeserializer.DeserializeExplorationPlan(testInput); });
        }