Ejemplo n.º 1
0
        public void ChunkThousands()
        {
            var random    = new Random();
            var count     = random.Next(2001, 15000);
            var partition = Guid.NewGuid().ToString();
            var items     = new List <ITableEntity>();

            for (var i = 0; i < count; i++)
            {
                items.Add(new TableEntity()
                {
                    PartitionKey = partition
                });
            }

            var name = Guid.NewGuid().ToString();
            var t    = new TableStorage(name, ConnectionString);

            var batches = t.Chunk <ITableEntity>(items);

            Assert.AreEqual(Math.Ceiling(((double)count / TableStorage.MaimumxInsertBatch)), batches.Count());
            var resultCount = 0;

            foreach (var b in batches)
            {
                resultCount += b.Count();
            }
            Assert.AreEqual(count, resultCount);
        }
Ejemplo n.º 2
0
        public void ChunkNone()
        {
            var items = new List <ITableEntity>();

            var name = Guid.NewGuid().ToString();
            var t    = new TableStorage(name, ConnectionString);

            var batches = t.Chunk <ITableEntity>(items);

            Assert.AreEqual(0, batches.Count());
        }