public void DisjointedSortedSet_RemoveByScore_ExcludeStop() { var set = new DisjointedSortedSet(); set.Add(new[] { new StackExchange.Redis.SortedSetEntry("zero", 0), new StackExchange.Redis.SortedSetEntry("one", 1), new StackExchange.Redis.SortedSetEntry("two", 2) }); Assert.AreEqual(1, set.RetrieveByScore(0, 0, Exclude.None).Count()); Assert.AreEqual(1, set.RetrieveByScore(1, 1, Exclude.None).Count()); Assert.AreEqual(1, set.RetrieveByScore(2, 2, Exclude.None).Count()); set.RemoveByScore(0, 2, Exclude.Stop); Assert.IsNull(set.RetrieveByScore(0, 0, Exclude.None)); Assert.IsNull(set.RetrieveByScore(1, 1, Exclude.None)); Assert.AreEqual(1, set.RetrieveByScore(2, 2, Exclude.None).Count()); }
public void DisjointedSortedSet_RemoveByScore_ExcludeBoth() { var set = new DisjointedSortedSet(); set.Add(new[] { new StackExchange.Redis.SortedSetEntry("zero", 0), new StackExchange.Redis.SortedSetEntry("one", 1), new StackExchange.Redis.SortedSetEntry("two", 2) }); Assert.AreEqual(1, set.RetrieveByScore(0, 0, Exclude.None).Count()); Assert.AreEqual(1, set.RetrieveByScore(1, 1, Exclude.None).Count()); Assert.AreEqual(1, set.RetrieveByScore(2, 2, Exclude.None).Count()); set.RemoveByScore(0, 2, Exclude.Both); Assert.AreEqual(1, set.RetrieveByScore(0, 0, Exclude.None).Count()); Assert.IsNotNull(set.RetrieveByScore(1, 1, Exclude.None)); //There is still a valid range of "0, 2", which no longer contains 1. So we know 1 doesn't exist. Assert.AreEqual(0, set.RetrieveByScore(1, 1, Exclude.None).Count()); Assert.AreEqual(1, set.RetrieveByScore(2, 2, Exclude.None).Count()); }