public async Task GivenASetWithTwoItems_RemovingOneItemFromSet_ResultsInASetWithOneItem() { // Arrange. var key = DateTime.Now.Ticks.ToString(); var itemOne = new TestCacheObject("a"); var itemTwo = new TestCacheObject("b"); await _redis.AddToSetAsync(key, new[] { itemOne, itemTwo }, TimeSpan.FromMinutes(1)); // Act. await _redis.DeleteFromSetAsync(key, itemOne, TimeSpan.FromMinutes(1)); // Assert. var members = await _redis.GetSetAsync <TestCacheObject>(key); members.ShouldNotBe(null); members.Count().ShouldBe(1); members.ShouldContain(member => member.Key == itemTwo.Key); members.ShouldNotContain(member => member.Key == itemOne.Key); }
public async Task GivenASingleItem_AddingToSet_ResultsInASetWithOneItem() { // Arrange. var key = DateTime.Now.Ticks.ToString(); var item = new TestCacheObject("a"); // Act. await _redis.AddToSetAsync(key, item, TimeSpan.FromMinutes(1)); // Assert. var members = await _redis.GetSetAsync <TestCacheObject>(key); members.ShouldNotBe(null); members.Count().ShouldBe(1); members.ShouldContain(member => member.Key == item.Key); }