public void ActionCalls_are_always_global_without_namespace()
        {
            /*
             * 1) Select all Messages
             * 2) Filter for any (namespace independent) "fibonacci" action calls
             */
            var fibonacciActionMessages = Scenario
                                          .Messages
                                          .ForAction("**/fibonacci")
                                          .Calls();

            fibonacciActionMessages.Should().NotBeEmpty();

            /*
             * Action name should be a global name
             * Action name should not have a placeholder
             * All messages belong to the actionName namespace
             */
            foreach (var actionCall in fibonacciActionMessages)
            {
                var actionName = actionCall.ActionName;

                RosNameRegex.IsGlobalPattern(actionName).Should().BeTrue();
                RosNameRegex.ContainsPlaceholders(actionName).Should().BeFalse();

                actionCall.GoalMessage.Topic.Should().StartWith(actionName);
                actionCall.ResultMessage?.Topic.Should().StartWith(actionName);
                actionCall.FeedbackMessages.Should().OnlyContain(x => x.Topic.StartsWith(actionName));
            }
        }
        public static ActionMessagesCollection Create(string actionNamePattern, IEnumerable <IRecordedMessage> messages)
        {
            if (actionNamePattern == null)
            {
                throw new ArgumentNullException(nameof(actionNamePattern));
            }
            if (messages == null)
            {
                throw new ArgumentNullException(nameof(messages));
            }

            actionNamePattern = actionNamePattern.Trim();

            if (string.Empty.Equals(actionNamePattern))
            {
                throw new InvalidRosNamePatternException("ROS name pattern must not be empty", nameof(actionNamePattern));
            }

            if (actionNamePattern.EndsWith("/"))
            {
                throw new InvalidRosNamePatternException(
                          "ROS name pattern must not end with a namespace separator ('/')", nameof(actionNamePattern));
            }


            var actionName = actionNamePattern.Substring(actionNamePattern.LastIndexOf("/", StringComparison.InvariantCulture) + 1);

            if (RosNameRegex.ContainsPlaceholders(actionName))
            {
                throw new InvalidRosNamePatternException("ROS action name must not contain any placeholders", nameof(actionNamePattern));
            }

            var actionTopicsPattern = actionNamePattern + "/*";
            var actionMessages      = messages
                                      .InTopic(actionTopicsPattern);

            var actionMessagesCollection = new ActionMessagesCollection(actionNamePattern, actionMessages);

            return(actionMessagesCollection);
        }