Beispiel #1
0
        public void InmemoryStorage_AddToList_Multiple()
        {
            var storage = new InmemoryStorage();

            storage.AddToList(new StorageKey("storage", "key"), "one");
            storage.AddToList(new StorageKey("storage", "key"), "two");
        }
Beispiel #2
0
        public void InmemoryStorage_List_Objects()
        {
            var storage = new InmemoryStorage();

            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Id = 1, Value = "one"
            });
            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Id = 2, Value = "two"
            });

            var items = storage.GetList <StorageModel>(new StorageKey("storage", "key"));

            items.MatchSnapshot();
        }
Beispiel #3
0
        public void InmemoryStorage_RemoveRange()
        {
            var storage = new InmemoryStorage();

            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Id = 1, Value = "one"
            });
            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Id = 1, Value = "one"
            });

            Assert.AreEqual(2, storage.GetList <StorageModel>(new StorageKey("storage", "key")).Count());

            storage.RemoveRangeFromList(new StorageKey("storage", "key"), 3);

            Assert.IsEmpty(storage.GetList <StorageModel>(new StorageKey("storage", "key")));
        }
Beispiel #4
0
        public void InmemoryStorage_Get_Invalid()
        {
            var storage = new InmemoryStorage();

            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Id = 1, Value = "one"
            });

            Assert.IsNull(storage.Get <StorageModel>(new StorageKey("storage", "key")));
        }
Beispiel #5
0
        public void InmemoryStorage_AddToList()
        {
            var storage = new InmemoryStorage();

            storage.AddToList(new StorageKey("storage", "key"), "value");
        }