private IEnumerable <KeyValuePair <string, string> > GetServiceEntries(string scope = null, string serviceName = null) { scope = scope ?? _globalPrefix; string prefix = $"services/{scope}"; if (serviceName != null) { prefix = $"{prefix}/{serviceName}"; } return(_keyValueStore.GetRange(prefix)); }
public static void AssertCanGetRange(IKeyValueStore store) { SinglePutGet(store, "range_key1", "range_value1"); SinglePutGet(store, "range_key2", "range_value2"); List <KeyValuePair <string, string> > keyValuePairs = store.GetRange("range").ToList(); Assert.AreEqual(2, keyValuePairs.Count); var key1List = keyValuePairs.Where(kvp => kvp.Key == "range_key1").ToList(); Assert.AreEqual(1, key1List.Count); Assert.AreEqual("range_value1", key1List[0].Value); var key2List = keyValuePairs.Where(kvp => kvp.Key == "range_key2").ToList(); Assert.AreEqual(1, key2List.Count); Assert.AreEqual("range_value2", key2List[0].Value); }