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

            storeMembers.Add(storeMembers2.First());
            storeMembers2.Add(storeMembers.First());

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

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

            var intersectingMembers = await redis.GetIntersectFromSetsAsync(new[] { Set, Set2 });

            var intersect = (await Set.ToListAsync()).Intersect((await Set2.ToListAsync())).ToList();

            Assert.That(intersectingMembers, Is.EquivalentTo(intersect));
        }