public void NodeIdForANullEndpointShouldBeNull()
        {
            var logicalRoutingNodeStrategy = new LogicalRoutingNodeStrategy();

            var nodeId = logicalRoutingNodeStrategy.GetNodeId(null);

            Assert.IsNull(nodeId);
        }
        public void NodeIdForANullEndpointShouldBeNull()
        {
            var logicalRoutingNodeStrategy = new LogicalRoutingNodeStrategy();

            var nodeId = logicalRoutingNodeStrategy.GetNodeId(null);

            Assert.IsNull(nodeId);
        }
        public void CanAcceptMessageWithoutHeaders()
        {
            var endpointNodeStrategy = new LogicalRoutingNodeStrategy();
            var messageNodeStrategy = new CollapseMessagesToSameReceiverMessageNodeStrategy(endpointNodeStrategy);
            var nodeStrategy = new NodeStrategy(endpointNodeStrategy, messageNodeStrategy);
            var modelBuilder = new ModelBuilder(nodeStrategy);

            var message = new ProcessedMessage
            {
                Headers = new Dictionary<string, string>()
            };

            Assert.DoesNotThrow(
                () => modelBuilder.Accept(message)
            );
        }
        public void CanAcceptMessageWithoutHeaders()
        {
            var endpointNodeStrategy = new LogicalRoutingNodeStrategy();
            var messageNodeStrategy  = new CollapseMessagesToSameReceiverMessageNodeStrategy(endpointNodeStrategy);
            var nodeStrategy         = new NodeStrategy(endpointNodeStrategy, messageNodeStrategy);
            var modelBuilder         = new ModelBuilder(nodeStrategy);

            var message = new ProcessedMessage
            {
                Headers = new Dictionary <string, string>()
            };

            Assert.DoesNotThrow(
                () => modelBuilder.Accept(message)
                );
        }
        private static NodeStrategy GetNodeStrategy()
        {
            // Logical Routing Strategy collapses endpoints with the same name into a single endpoint. Even if running on different hosts
            var logicalEndpoints = new LogicalRoutingNodeStrategy();
            // Physical Routing Strategy will split up endpoints that have the same name but run on different hosts
            //var physicalEndpoints = new PhysicalRoutingNodeStrategy();

            var endpoints = logicalEndpoints;

            // All messages of the same type that come from the same sender will be collapsed into a single message node
            var collapseFromSender = new CollaseMessagesFromSameSenderMessageNodeStrategy(endpoints);

            // All messages of the same type that go to the same receiver will be collapsed into a single message node
            //var collapseToReceiver = new CollapseMessagesToSameReceiverMessageNodeStrategy(endpoints);

            // All published events of the same type and sender will collapse into one,
            // all non-events of the same type and sent to the same reciever collapses into one
            //var intentBasedMessageNodeStrategy = new IntentBasedMessageNodeStrategy(collapseToReceiver);
            //intentBasedMessageNodeStrategy.Add("Publish", collapseFromSender);

            var messages = collapseFromSender;

            return new NodeStrategy(endpoints, messages);
        }