public void Set_NullItem_RemovesItem() { var cache = new ManosInProcCache(); var existing = new object(); cache.Set("foo", existing); cache.Set("foo", null); cache.Get("foo", (name, item) => { Assert.IsNull(item); }); }
public void Set_KeyAlreadyExists_ReplacesItem() { var cache = new ManosInProcCache(); var existing = new object(); var new_item = new object(); cache.Set("foo", existing); cache.Set("foo", new_item); cache.Get("foo", (name, item) => { Assert.AreSame(new_item, item); }); }
public void Set_NullKey_Throws() { var cache = new ManosInProcCache(); var item = "foo"; Should.Throw <ArgumentNullException> (() => cache.Set(null, item)); }
public void Clear_RemovesRegisteredItem() { var cache = new ManosInProcCache (); var existing = new object (); cache.Set ("foo", existing); cache.Clear (); var retrieved = cache.Get ("foo"); Assert.IsNull (retrieved); }
public void Set_NewKey_AddsItem() { var cache = new ManosInProcCache(); var bar = new object(); cache.Set("foo", bar); cache.Get("foo", (name, item) => { Assert.AreSame(bar, item); }); }
public void Clear_RemovesRegisteredItem() { var cache = new ManosInProcCache (); var existing = new object (); cache.Set ("foo", existing); cache.Clear (); cache.Get ("foo", (name, item) => { Assert.IsNull (item); }); }
public void Clear_RemovesRegisteredItem() { var cache = new ManosInProcCache(); var existing = new object(); cache.Set("foo", existing); cache.Clear(); cache.Get("foo", (name, item) => { Assert.IsNull(item); }); }
public void Set_KeyAlreadyExists_ReplacesItem() { var cache = new ManosInProcCache (); var existing = new object (); var new_item = new object (); cache.Set ("foo", existing); cache.Set ("foo", new_item); var retrieved = cache.Get ("foo"); Assert.AreSame (new_item, retrieved); }
public void Set_NullKey_Throws() { var cache = new ManosInProcCache (); var item = "foo"; Should.Throw<ArgumentNullException> (() => cache.Set (null, item)); }
public void Set_NullItem_RemovesItem() { var cache = new ManosInProcCache (); var existing = new object (); cache.Set ("foo", existing); cache.Set ("foo", null); var retrieved = cache.Get ("foo"); Assert.IsNull (retrieved); }
public void Set_NullItem_DoesNotThrow() { var cache = new ManosInProcCache (); Should.NotThrow(() => cache.Set ("foo", null)); }
public void Set_NewKey_AddsItem() { var cache = new ManosInProcCache (); var bar = new object (); cache.Set ("foo", bar); var retrieved = cache.Get ("foo"); Assert.AreSame (bar, retrieved); }
public void Set_NullItem_RemovesItem() { var cache = new ManosInProcCache (); var existing = new object (); cache.Set ("foo", existing); cache.Set ("foo", null); cache.Get ("foo", (name, item) => { Assert.IsNull (item); }); }
public void Set_NewKey_AddsItem() { var cache = new ManosInProcCache (); var bar = new object (); cache.Set ("foo", bar); cache.Get ("foo", (name, item) => { Assert.AreSame (bar, item); }); }
public void Set_KeyAlreadyExists_ReplacesItem() { var cache = new ManosInProcCache (); var existing = new object (); var new_item = new object (); cache.Set ("foo", existing); cache.Set ("foo", new_item); cache.Get ("foo", (name, item) => { Assert.AreSame (new_item, item); }); }
public void Set_NullItem_DoesNotThrow() { var cache = new ManosInProcCache(); Should.NotThrow(() => cache.Set("foo", null)); }