Ejemplo n.º 1
0
        public void TestAddBatch()
        {
            var set = new RedisEntrySet <int, MockEntity> (base.Database, SetKey);

            set.Clear();
            Assert.Equal(0, set.Count);
            var batch    = Database.CreateBatch();
            var batchSet = set.AsBatch();

            foreach (var item in GetEntities(10))
            {
                batchSet.BatchAdd(batch, item.Id, item);
            }
            batch.Execute();
            Assert.Equal(10, set.Count);
        }
Ejemplo n.º 2
0
        public async Task TestEntitySetBatch()
        {
            var client   = CreateRedisClient();
            var SetKey   = "TEST:Users:Batch:";
            var userSet  = new RedisEntrySet <int, User> (client.Db0.Database, SetKey);
            var batch    = client.Db0.Database.CreateBatch();
            var batchSet = userSet.AsBatch();

            foreach (var user in GetUsers(SampleCount))
            {
                await batchSet.BatchAdd(batch, user.UserId, user);
            }
            batch.Execute();

            Assert.Equal(SampleCount, userSet.Count);
            //Assert.True(userSet.Values.All(u => u.Firstname == "Test UserName"));
        }