public async Task CreateQueue() { TCacheService cache = new TCacheService(TestConfiguration.EnvRedisUri); await cache.PushToQueue(TestQueueName, new List <Cat> { new Cat { Name = "Ted", Age = 3 } }); Assert.True(await cache.QueueExists(TestQueueName)); }
public async Task TestRemoveExistingQueue() { using (TCacheService cache = new TCacheService(TestConfiguration.EnvRedisUri)) { await cache.PushToQueue(TestRemoveQueue, new List <Cat> { new Cat { Name = "Kel", Age = 12 } }); await cache.RemoveQueue(TestRemoveQueue); bool result = await cache.QueueExists(TestRemoveQueue); Assert.False(result); } }
public async Task BasicGetQueue() { // NOTE: This test is both to test the basic string fetch functionality and it tests to see if an empty LIST key properly unsets using (TCacheService cache = new TCacheService()) { await cache.PushToQueue(TestQueueNameSecond, new List <Cat> { new Cat { Name = "Amolee" } }); string result = await cache.PopFromQueue(TestQueueNameSecond); bool resultCheck = result.Contains("Amolee"); bool queueExists = await cache.QueueExists(TestQueueNameSecond); Assert.True(resultCheck && !queueExists); } }
public async Task GetQueue() { TCacheService cache = new TCacheService(TestConfiguration.EnvRedisUri); await cache.PushToQueue(TestQueueName, new List <Cat> { new Cat { Name = "NotDead", Age = 3 } }); Cat cat1 = await cache.PopFromQueue <Cat>(TestQueueName, TCachePopMode.Get); Cat cat2 = await cache.PopFromQueue <Cat>(TestQueueName, TCachePopMode.Get); bool done = cat1.Name == "NotDead" && cat2.Name == "NotDead"; // make sure the queue is empty Cat cat3 = await cache.PopFromQueue <Cat>(TestQueueName, TCachePopMode.Delete); Cat cat4 = await cache.PopFromQueue <Cat>(TestQueueName, TCachePopMode.Delete); if (cat3 != null) { Console.WriteLine(cat3.Name); } if (cat4 != null) { Console.WriteLine(cat4.Name); } done = done && cat3 != null && cat4 == null; // remove the queue await cache.RemoveQueue(TestQueueName); // result Assert.True(done); }
public async Task <bool> PushToQueue(string queueName, List <string> values) { return(await _cacheService.PushToQueue(queueName, values)); }