예제 #1
0
        public void Parse_IfNotSupportedFormat_Throw(string commands)
        {
            // Arrange
            SimpleCommandParser sut = CreateSut();

            // Act
            Action act = () => sut.Parse(commands);

            // Assert
            act.Should().Throw <ArgumentException>()
            .WithMessage($"Unsupported format. (Parameter 'commands')");
        }
예제 #2
0
        public void Parse_IfSupportedFormat_DoesNotThrow()
        {
            // Arrange
            string commands         = "RFRFRFRF";
            SimpleCommandParser sut = CreateSut();

            // Act
            Action act = () => sut.Parse(commands);

            // Assert
            act.Should().NotThrow();
        }
예제 #3
0
        public void Parse_IfCommandNotNull_DoesNotThrow()
        {
            // Arrange
            string commands         = string.Empty;
            SimpleCommandParser sut = CreateSut();

            // Act
            Action act = () => sut.Parse(commands);

            // Assert
            act.Should().NotThrow <ArgumentNullException>();
        }
예제 #4
0
        public void Parse_IfCommandNull_Throws()
        {
            // Arrange
            string commands         = null;
            SimpleCommandParser sut = CreateSut();

            // Act
            Action act = () => sut.Parse(commands);

            // Assert
            act.Should().Throw <ArgumentNullException>()
            .WithMessage($"Parameter can not be null. (Parameter 'commands')");
        }
예제 #5
0
        public void Parse_ReturnsCommands()
        {
            // Arrange
            string commands         = "RFLF";
            SimpleCommandParser sut = CreateSut();

            // Act
            IReadOnlyCollection <IRobotCommand> resultCommands = sut.Parse(commands);

            // Assert
            Type[] expectedTypes = new Type[] { typeof(RCommand), typeof(FCommand), typeof(LCommand), typeof(FCommand) };
            Type[] actualTypes   = resultCommands.Select(command => command.GetType()).ToArray();
            actualTypes.Should().Equal(expectedTypes);
        }