public void OnVisitBuiltInType_called_in_constant_declaration(string dataType, object value) { var message = $"{dataType} CONST = {value}"; var expectedPrimitiveType = RosTypeInfo.CreateBuiltIn(dataType); var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitBuiltInType(expectedPrimitiveType)); }
public void OnVisitRosType_called_in_constant_decalaration_for_external_type() { var message = $"std_msgs/Bool CONST = True"; var expectedTypeDescriptor = RosTypeInfo.CreateRosType("std_msgs", "Bool"); var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitRosType(expectedTypeDescriptor)); }
public void OnVisitBuiltInType_called_infield_declaration(string dataType) { var message = $"{dataType} fieldName"; var expectedBuiltInType = RosTypeInfo.CreateBuiltIn(dataType);; var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitBuiltInType(expectedBuiltInType)); }
public void Empty_comment_returns_empty_string() { string expectedComment = string.Empty; var message = $"MyType fieldName #"; var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitComment(expectedComment)); }
public void Comment_returns_comment_without_leading_and_trailing_whitespaces() { const string expectedComment = "This is my Comment"; var message = $"MyType fieldName # \t{expectedComment} \t"; var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitComment(expectedComment)); }
public void OnVisitIdentifier_called_in_const_declaration() { var expectedIdentifier = "CONST_NAME"; var message = $"bool {expectedIdentifier} = True"; var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitIdentifier(expectedIdentifier)); }
public void OnVisitRosType_called_in_field_decalaration_for_header_type() { var message = $"Header fieldName"; var expectedTypeDescriptor = RosTypeInfo.CreateRosType("std_msgs", "Header"); var messageParser = ParserHelper.CreateParserForMessage(message); var context = messageParser.ros_message(); var mock = new Mock <IRosMessageVisitorListener>(); var visitor = new RosMessageVisitor(mock.Object); visitor.Visit(context); mock.Verify(x => x.OnVisitRosType(expectedTypeDescriptor)); }