コード例 #1
0
        public void RedisStorageStoresAndRemovesObjectsInBulks()
        {
            KeyValuePair<string, string>[] objectsToStore = new KeyValuePair<string, string>[100];
            for (int i = 0; i < objectsToStore.Length; i++)
            {
                objectsToStore[i] = new KeyValuePair<string, string>(Guid.NewGuid().ToString(), "jack checked chicken");
            }

            using (var storage = new RedisStorage(RedisStorageTests.Host))
            {
                storage.BulkStore(objectsToStore);
                storage.BulkRemove(objectsToStore.Select(o => o.Key).ToArray());
                foreach (var @object in objectsToStore)
                {
                    Assert.That(() => storage.Retrieve<string>(@object.Key),
                        Throws.InstanceOf<ArgumentOutOfRangeException>());
                }
            }
        }