public void GetServiceTags_should_ignore_all_remaining_matched_replica_properties() { IApplicationInfoProperties properties = new TestApplicationInfoProperties(); var replica1 = "http://replica.dev:2222"; var replica2 = "http://replica:2222"; var replica3 = "http://replica.dev.other:2222"; var replica1Tags = new TagCollection { "Tag1" }; var replica2Tags = new TagCollection { "Tag2", "Tag3" }; var replica3Tags = new TagCollection { "Tag3", "Tag4" }; properties = properties .AddReplicaTags(replica1, ReplicaTagKind.Persistent, replica1Tags) .AddReplicaTags(replica2, ReplicaTagKind.Persistent, replica2Tags) .AddReplicaTags(replica3, ReplicaTagKind.Persistent, replica3Tags); properties.GetTags().Should().BeEquivalentTo(new Dictionary <string, TagCollection> { { replica1, replica1Tags }, { replica2, replica2Tags }, { replica3, replica3Tags } }); properties.GetServiceTags().Should().BeEquivalentTo(new Dictionary <Uri, TagCollection> { { new Uri(replica1), replica3Tags } }); }
public void AddTags_for_given_service_replica_should_correctly_parse_service_replicas() { IApplicationInfoProperties properties = new TestApplicationInfoProperties(); var replica1 = "http://localhost:1234/"; var replica2 = "replica2"; var replica3 = "replica3:1234"; var replica4 = "replica4:5678"; var replica1Tags = new TagCollection { { "tag1", "value1" }, { "tag2", "value1" }, "tag3" }; var replica2Tags = new TagCollection { "tag4", { "tag5", "value3" }, "tag6" }; var replica3Tags = new TagCollection { "tag7", { "tag8", "value4" }, "tag9" }; var replica4Tags = new TagCollection { "tag10", { "tag11", "value5" }, "tag12" }; properties = properties.AddReplicaTags(replica1, ReplicaTagKind.Persistent, replica1Tags); properties.GetReplicaTags(replica1).Should().BeEquivalentTo(replica1Tags); properties.GetReplicaTags(replica2).Should().BeEquivalentTo(new TagCollection()); properties = properties.AddReplicaTags(replica2, ReplicaTagKind.Persistent, replica2Tags); properties.GetReplicaTags(replica1).Should().BeEquivalentTo(replica1Tags); properties.GetReplicaTags(replica2).Should().BeEquivalentTo(replica2Tags); properties = properties.AddReplicaTags(replica3, ReplicaTagKind.Persistent, replica3Tags); properties.GetReplicaTags(replica3).Should().BeEquivalentTo(replica3Tags); properties = properties.AddReplicaTags(replica4, ReplicaTagKind.Persistent, replica4Tags); properties.GetReplicaTags(replica4).Should().BeEquivalentTo(replica4Tags); properties.GetTags() .Should() .BeEquivalentTo( new Dictionary <string, TagCollection> { { replica1, replica1Tags }, { replica2, replica2Tags }, { replica3, replica3Tags }, { replica4, replica4Tags } }); properties.GetServiceTags() .Should() .BeEquivalentTo( new Dictionary <Uri, TagCollection> { { new Uri(replica1), replica1Tags } }); }