Example #1
0
        public void RedisStorageDoesntAllowDuplicateStoreWithStoreMethod()
        {
            var objectToStore = "my object";
            var objectName = Guid.NewGuid().ToString();

            using (var storage = new RedisStorage(RedisStorageTests.Host))
            {
                storage.Store(objectName, objectToStore);
                Assert.That(() => storage.Store(objectName, objectToStore), Throws.Exception);
            }
        }
Example #2
0
        public void RedisStorageStoresAndRemovesObjects()
        {
            var objectToStore = "my object";
            var objectName = Guid.NewGuid().ToString();

            using (var storage = new RedisStorage(RedisStorageTests.Host))
            {
                storage.Store(objectName, objectToStore);
                storage.Remove(objectName);
                Assert.That(() => storage.Retrieve<string>(objectName),
                    Throws.InstanceOf<ArgumentOutOfRangeException>());
            }
        }
Example #3
0
        public void RedisStorageStoresAndRetrievesComplexObjects()
        {
            var objectToStore = new ComplexParameter()
                {
                    SomeProperty = "this is string",
                    AnotherProperty = 47
                };
            var objectName = Guid.NewGuid().ToString();

            using (var storage = new RedisStorage(RedisStorageTests.Host))
            {
                storage.Store(objectName, objectToStore);
                var retrievedObject = storage.Retrieve<ComplexParameter>(objectName);

                retrievedObject.SomeProperty.ShouldBe(objectToStore.SomeProperty);
                retrievedObject.AnotherProperty.ShouldBe(objectToStore.AnotherProperty);
            }
        }
Example #4
0
        public void RedisStorageStoresAndRetrievesObjects()
        {
            var objectToStore = "my object";
            var objectName = Guid.NewGuid().ToString();

            using (var storage = new RedisStorage(RedisStorageTests.Host))
            {
                storage.Store(objectName, objectToStore);
                string retrievedObject = storage.Retrieve<string>(objectName);

                retrievedObject.ShouldBe(objectToStore);
            }
        }