public void GetMostSpecificMatch_ReturnsNull_IfNoMatches() { var list = new List <KeyValue> { new KeyValue { Key = "ss/notfound" } }; KeyUtilities.GetMostSpecificMatch(list, Key).Should().BeNull(); }
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}"); }
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}"); }
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"); }
public void GetMostSpecificMatch_ReturnsNull_IfCandidatesEmpty() => KeyUtilities.GetMostSpecificMatch(new List <KeyValue>(), Key).Should().BeNull();
public void GetMostSpecificMatch_ReturnsNull_IfCandidatesNull() => KeyUtilities.GetMostSpecificMatch(null, Key).Should().BeNull();