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')"); }
public void Parse_IfSupportedFormat_DoesNotThrow() { // Arrange string commands = "RFRFRFRF"; SimpleCommandParser sut = CreateSut(); // Act Action act = () => sut.Parse(commands); // Assert act.Should().NotThrow(); }
public void Parse_IfCommandNotNull_DoesNotThrow() { // Arrange string commands = string.Empty; SimpleCommandParser sut = CreateSut(); // Act Action act = () => sut.Parse(commands); // Assert act.Should().NotThrow <ArgumentNullException>(); }
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')"); }
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); }