コード例 #1
0
        public void GivenAnEmptyLine_WhenProcessing_ThenWillNotAddDroneCommands()
        {
            var handler = new DroneMovementLineHandler();

            handler.Process(_contextMock.Object, "");

            _contextMock.Verify(x => x.AddDroneCommand(It.IsAny <IDroneCommand>()), Times.Never);
        }
コード例 #2
0
        public void GivenALineWithValidCharacters_WhenProcessing_ThenWillAddDroneCommands()
        {
            var handler  = new DroneMovementLineHandler();
            var commands = "<<>>**<<>>**";

            handler.Process(_contextMock.Object, commands);

            _contextMock.Verify(x => x.AddDroneCommand(It.IsNotNull <IDroneCommand>()), Times.Exactly(commands.Length));
        }
コード例 #3
0
        public void GivenALineWithAnInvalidCharacter_WhenParsingDroneMovement_ThenWillThrowFormatException()
        {
            var handler = new DroneMovementLineHandler();

            Assert.That(() => handler.Process(_contextMock.Object, "<<>>**A<<>>**"), Throws.InstanceOf <FormatException>());
        }
コード例 #4
0
        public void GivenALineWithExtraSpace_WhenParsingDroneMovement_ThenWillReturnDroneMovements()
        {
            var handler = new DroneMovementLineHandler();

            Assert.That(() => handler.Process(_contextMock.Object, " "), Throws.InstanceOf <FormatException>());
        }