public void Add_CacheItem_CacheItemPolicy () { var poker = new PokerObjectCache (); bool ret; ret = poker.Add (null, null); Assert.IsTrue (ret, "#A1-1"); Assert.AreEqual ("AddOrGetExisting (CacheItem value, CacheItemPolicy policy)", poker.MethodCalled, "#A1-2"); var item = new CacheItem ("key", 1234); ret = poker.Add (item, null); Assert.IsTrue (ret, "#A2-1"); Assert.AreEqual ("AddOrGetExisting (CacheItem value, CacheItemPolicy policy)", poker.MethodCalled, "#A2-2"); ret = poker.Add (item, null); Assert.IsFalse (ret, "#A3-1"); Assert.AreEqual ("AddOrGetExisting (CacheItem value, CacheItemPolicy policy)", poker.MethodCalled, "#A3-2"); }
public void Add_String_Object_CacheItemPolicy_String () { var poker = new PokerObjectCache (); bool ret; ret = poker.Add (null, null, null, null); Assert.IsTrue (ret, "#A1-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, CacheItemPolicy policy, string regionName = null)", poker.MethodCalled, "#A1-2"); ret = poker.Add ("key", 1234, null, null); Assert.IsTrue (ret, "#A2-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, CacheItemPolicy policy, string regionName = null)", poker.MethodCalled, "#A2-2"); ret = poker.Add ("key", 1234, null, null); Assert.IsFalse (ret, "#A2-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, CacheItemPolicy policy, string regionName = null)", poker.MethodCalled, "#A2-2"); }
public void GetValues () { var poker = new PokerObjectCache (); IDictionary<string, object> values = poker.GetValues (null, (string []) null); Assert.IsNotNull (values, "#A1-1"); Assert.AreEqual (0, values.Count, "#A1-2"); Assert.AreEqual ("IDictionary<string, object> GetValues (IEnumerable<string> keys, string regionName = null)", poker.MethodCalled, "#A1-3"); poker.Add ("key1", 1, null); poker.Add ("key2", 2, null); poker.Add ("key3", 3, null); values = poker.GetValues (new string [] { "key1", "key2", "key3" }); Assert.IsNotNull (values, "#A2-1"); Assert.AreEqual (3, values.Count, "#A2-2"); Assert.AreEqual ("IDictionary<string, object> GetValues (IEnumerable<string> keys, string regionName = null)", poker.MethodCalled, "#A2-3"); values = poker.GetValues (new string [] { "key1", "key22", "key3" }); Assert.IsNotNull (values, "#A3-1"); Assert.AreEqual (2, values.Count, "#A3-2"); Assert.AreEqual ("IDictionary<string, object> GetValues (IEnumerable<string> keys, string regionName = null)", poker.MethodCalled, "#A3-3"); }
public void Add_String_Object_DateTimeOffset_String () { var poker = new PokerObjectCache (); bool ret; ret = poker.Add (null, null, DateTimeOffset.Now, null); Assert.IsTrue (ret, "#A1-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)", poker.MethodCalled, "#A1-2"); ret = poker.Add ("key", 1234, DateTimeOffset.Now, null); Assert.IsTrue (ret, "#A2-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)", poker.MethodCalled, "#A2-2"); ret = poker.Add ("key", 1234, DateTimeOffset.Now, null); Assert.IsFalse (ret, "#A2-1"); Assert.AreEqual ("AddOrGetExisting (string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)", poker.MethodCalled, "#A2-2"); }