コード例 #1
0
        public void TestInvalidPlaceDirection()
        {
            // arrange
            var paramParser = new PlaceCommandParameterParser();

            string[] rawInput = "PLACE 2,4,OneDirection".Split(' ');

            // act and assert
            var exception = Assert.Throws <ArgumentException>(delegate { paramParser.ParseParameters(rawInput); });

            Assert.That(exception.Message, Is.EqualTo("Invalid direction. Please select from one of the following directions: NORTH|EAST|SOUTH|WEST"));
        }
コード例 #2
0
        public void TestInvalidPlaceParamsFormat()
        {
            // arrange
            var paramParser = new PlaceCommandParameterParser();

            string[] rawInput = "PLACE 3,3,SOUTH,2".Split(' ');

            // act and assert
            var exception = Assert.Throws <ArgumentException>(delegate { paramParser.ParseParameters(rawInput); });

            Assert.That(exception.Message, Is.EqualTo("Incomplete command. Please ensure that the PLACE command is using format: PLACE X,Y,F"));
        }