Пример #1
0
        public void WorkWithStringBasedKeys()
        {
            var instance = new DictionaryDataStoreAdapter(new Dictionary <string, object>());

            instance.Set <int>(5);

            Assert.Equal(5, instance.Get <int>());
        }
Пример #2
0
        public void SetViaGenerics()
        {
            var instance = new DictionaryDataStoreAdapter(Dictionary);

            instance.Set <bool>(true);

            Assert.True(instance.Get <bool>());
        }
Пример #3
0
        public void SetViaKey()
        {
            var instance = new DictionaryDataStoreAdapter(Dictionary);
            var random   = new { Some = "Test", Data = 5 };

            instance.Set("random", random);

            Assert.Equal(random, instance.Get("random"));
        }
Пример #4
0
        public void GetViaGenericsWithKey()
        {
            var instance = new DictionaryDataStoreAdapter(Dictionary);

            var result = instance.Get <int>("intKey");

            Assert.Equal(5, result);
            Assert.IsType <int>(result);
        }
Пример #5
0
        public void GetViaGenerics()
        {
            var instance = new DictionaryDataStoreAdapter(Dictionary);

            var result = instance.Get <string>();

            Assert.Equal("TestString", result);
            Assert.IsType <string>(result);
        }
Пример #6
0
        public void GetViaKey()
        {
            var instance = new DictionaryDataStoreAdapter(Dictionary);

            Assert.Equal(5, instance.Get("intKey"));
        }