Stores the information about instances of known endpoints.
コード例 #1
0
        public void Should_default_to_single_instance_when_not_configured()
        {
            var instances = new EndpointInstances();
            var salesInstancess = instances.FindInstances("Sales");

            var singleInstance = salesInstancess.Single();
            Assert.IsNull(singleInstance.Discriminator);
            Assert.IsEmpty(singleInstance.Properties);
        }
コード例 #2
0
 public void Setup()
 {
     routingTable = new UnicastRoutingTable();
     endpointInstances = new EndpointInstances();
     router = new UnicastSendRouter(
         routingTable,
         endpointInstances,
         i => i.ToString());
 }
コード例 #3
0
        public void Should_filter_out_duplicate_instances()
        {
            var instances = new EndpointInstances();
            var sales = "Sales";
            instances.AddOrReplaceInstances("A", new List<EndpointInstance>
            {
                new EndpointInstance(sales, "dup"),
                new EndpointInstance(sales, "dup")
            });

            var salesInstances = instances.FindInstances(sales);
            Assert.AreEqual(1, salesInstances.Count());
        }
コード例 #4
0
        public void Should_return_instances_configured_by_static_route()
        {
            var instances = new EndpointInstances();
            var sales = "Sales";
            instances.AddOrReplaceInstances("A", new List<EndpointInstance>
            {
                new EndpointInstance(sales, "1"),
                new EndpointInstance(sales, "2")
            });

            var salesInstances = instances.FindInstances(sales);
            Assert.AreEqual(2, salesInstances.Count());
        }
コード例 #5
0
        public void Should_add_instances_grouped_by_endpoint_name()
        {
            var instances = new EndpointInstances();
            const string endpointName1 = "EndpointA";
            const string endpointName2 = "EndpointB";
            instances.AddOrReplaceInstances("A", new List<EndpointInstance>
            {
                new EndpointInstance(endpointName1),
                new EndpointInstance(endpointName2)
            });

            var salesInstances = instances.FindInstances(endpointName1);
            Assert.AreEqual(1, salesInstances.Count());

            var otherInstances = instances.FindInstances(endpointName2);
            Assert.AreEqual(1, otherInstances.Count());
        }
コード例 #6
0
 public void Setup()
 {
     metadataRegistry = new MessageMetadataRegistry(new Conventions());
     endpointInstances = new EndpointInstances();
     subscriptionStorage = new FakeSubscriptionStorage();
     router = new UnicastPublishRouter(
         metadataRegistry,
         subscriptionStorage);
 }