public void Filters_endpoint_instances_by_endpoint_name()
        {
            var instanceA = new EndpointInstanceId("EndpointA", "instance1");
            var instanceB = new EndpointInstanceId("EndpointB", "instance2");

            registry.Record(instanceA);
            registry.Record(instanceB);

            var instances = registry.GetForEndpointName("EndpointA");

            CollectionAssert.AreEquivalent(new [] { instanceA }, instances);
        }
Example #2
0
 static MonitoredEndpointInstance[] GetMonitoredEndpointInstances(EndpointRegistry endpointRegistry, string endpointName, EndpointInstanceActivityTracker activityTracker)
 {
     return(endpointRegistry.GetForEndpointName(endpointName)
            .Select(endpointInstance => new MonitoredEndpointInstance
     {
         Id = endpointInstance.InstanceId,
         Name = endpointInstance.InstanceName,
         IsStale = activityTracker.IsStale(endpointInstance)
     }).ToArray());
 }
        public void When_known_endpoint_instance_changes_name_existing_entry_is_used_and_udpated()
        {
            var registry = new EndpointRegistry();

            var originalId = new EndpointInstanceId("LogicalName", "instance-id", "original-name");
            var renamedId  = new EndpointInstanceId(originalId.EndpointName, originalId.InstanceId, "renamed-name");

            registry.Record(originalId);
            registry.Record(renamedId);

            var records = registry.GetForEndpointName(originalId.EndpointName).ToArray();

            Assert.AreEqual(1, records.Length, "Existing entry should be reused");
            Assert.AreEqual("renamed-name", records[0].InstanceName);
        }