AddOrReplaceInstances() public method

Adds or replaces a set of endpoint instances registered under a given key (registration source ID).
public AddOrReplaceInstances ( string sourceKey, IList endpointInstances ) : void
sourceKey string Source key.
endpointInstances IList List of endpoint instances known by this source.
return void
        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());
        }
        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());
        }
        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());
        }