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); } }
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>()); } }
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); } }
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); } }