public void ContainsWhenRegionNameDoesNotExistsTest() { const string REGION = "Test"; const string REGION2 = "Test2"; var _cache = new CollectionCache<object, object>(); var _key = new object(); var _value = new object(); var _addOrGetExisting = _cache.AddOrGetExisting(_key, _value, REGION); Assert.AreEqual(_value, _addOrGetExisting); Assert.Throws<KeyNotFoundException>(() => _cache.Contains(_key, _value, REGION2)); }
public void ContainsWhenRegionNameTest() { const string REGION = "Test"; var _cache = new CollectionCache<object, object>(); var _key = new object(); var _value = new object(); var _addOrGetExisting = _cache.AddOrGetExisting(_key, _value, REGION); Assert.AreEqual(_value, _addOrGetExisting); var _contains = _cache.Contains(_key, _value, REGION); Assert.IsTrue(_contains); }
public void ContainsWhenFalseTest() { var _cache = new CollectionCache<string, object>(); const string KEY = "Test"; var _value = new object(); var _addOrGetExisting = _cache.AddOrGetExisting(KEY, _value); Assert.AreEqual(_value, _addOrGetExisting); const string KEY2 = "Test2"; var _contains = _cache.Contains(KEY2, _value); Assert.IsFalse(_contains); }