Beispiel #1
0
        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);
            });
        }
Beispiel #2
0
        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);
            });
        }
Beispiel #3
0
        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);
        }
Beispiel #5
0
        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);
            });
        }
Beispiel #6
0
        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);
            });
        }
Beispiel #7
0
        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);
        }
Beispiel #13
0
        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);
            });
        }
Beispiel #14
0
        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);
            });
        }
Beispiel #15
0
        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);
            });
        }
Beispiel #16
0
        public void Set_NullItem_DoesNotThrow()
        {
            var cache = new ManosInProcCache();

            Should.NotThrow(() => cache.Set("foo", null));
        }