示例#1
0
        public async Task Can_DiffBetweenSets()
        {
            var storeMembers = Factory.CreateList();

            storeMembers.Add(Factory.CreateInstance(1));

            var storeMembers2 = Factory.CreateList2();

            storeMembers2.Insert(0, Factory.CreateInstance(4));

            var storeMembers3 = new List <T> {
                Factory.CreateInstance(1),
                Factory.CreateInstance(5),
                Factory.CreateInstance(7),
                Factory.CreateInstance(11),
            };

            await storeMembers.ForEachAsync(async x => await redis.AddItemToSetAsync(Set, x));

            await storeMembers2.ForEachAsync(x => redis.AddItemToSetAsync(Set2, x));

            await storeMembers3.ForEachAsync(x => redis.AddItemToSetAsync(Set3, x));

            var diffMembers = await redis.GetDifferencesFromSetAsync(Set, new[] { Set2, Set3 });

            Assert.That(diffMembers, Is.EquivalentTo(
                            new List <T> {
                Factory.CreateInstance(2), Factory.CreateInstance(3)
            }));
        }