예제 #1
0
        public void GetMostSpecificMatch_ReturnsNull_IfNoMatches()
        {
            var list = new List <KeyValue> {
                new KeyValue {
                    Key = "ss/notfound"
                }
            };

            KeyUtilities.GetMostSpecificMatch(list, Key).Should().BeNull();
        }
예제 #2
0
        public void GetMostSpecificMatch_ReturnsKey_IfNoService()
        {
            var list = new List <KeyValue> {
                new KeyValue {
                    Key = $"ss/{Key}"
                }
            };

            var result = KeyUtilities.GetMostSpecificMatch(list, Key);

            result.Key.Should().Be($"ss/{Key}");
        }
예제 #3
0
        public void GetMostSpecificMatch_ReturnsKey_IfNoMatchingService()
        {
            var list = new List <KeyValue>
            {
                new KeyValue {
                    Key = $"ss/{Key}"
                },
                new KeyValue {
                    Key = $"ss/{Key}/{AppHostFixture.ServiceName}spsps"
                }
            };

            var result = KeyUtilities.GetMostSpecificMatch(list, Key);

            result.Key.Should().Be($"ss/{Key}");
        }
예제 #4
0
        public void GetMostSpecificMatch_ReturnsReturnsInstanceFirst()
        {
            var list = new List <KeyValue>
            {
                new KeyValue {
                    Key = $"ss/{Key}"
                },
                new KeyValue {
                    Key = $"ss/{Key}/{AppHostFixture.ServiceName}"
                },
                new KeyValue {
                    Key = $"ss/{Key}/{AppHostFixture.ServiceName}/1.0"
                },
                new KeyValue {
                    Key = $"ss/{Key}/{AppHostFixture.ServiceName}/i/127.0.0.1:8090|api"
                }
            };

            var result = KeyUtilities.GetMostSpecificMatch(list, Key);

            result.Key.Should().Be($"ss/{Key}/{AppHostFixture.ServiceName}/i/127.0.0.1:8090|api");
        }
예제 #5
0
 public void GetMostSpecificMatch_ReturnsNull_IfCandidatesEmpty()
 => KeyUtilities.GetMostSpecificMatch(new List <KeyValue>(), Key).Should().BeNull();
예제 #6
0
 public void GetMostSpecificMatch_ReturnsNull_IfCandidatesNull()
 => KeyUtilities.GetMostSpecificMatch(null, Key).Should().BeNull();