public void BatchThousands()
        {
            var random    = new Random();
            var count     = random.Next(2001, 10000);
            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.Batch(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);
        }
        public void BatchDictionaryThousands()
        {
            var random    = new Random();
            var count     = random.Next(2001, 10000);
            var partition = Guid.NewGuid().ToString();
            var items     = new List <IDictionary <string, object> >();

            for (var i = 0; i < count; i++)
            {
                var dic = new Dictionary <string, object>();
                dic.Add(TableStorage.PartitionKey, partition);
                items.Add(dic);
            }

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

            var batches = t.Batch(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);
        }
        public void BatchDictionaryNone()
        {
            var items = new List <IDictionary <string, object> >();

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

            var batches = t.Batch(items);

            Assert.AreEqual(0, batches.Count());
        }
        public void BatchOne()
        {
            var items = new List <ITableEntity>();

            items.Add(new TableEntity());

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

            var batches = t.Batch(items);

            Assert.AreEqual(1, batches.Count());
            Assert.AreEqual(1, batches.First().Count());
        }
        public void BatchDictionaryOne()
        {
            var items = new List <IDictionary <string, object> >();
            var dic   = new Dictionary <string, object>();

            dic.Add(TableStorage.PartitionKey, Guid.NewGuid().ToString());
            items.Add(dic);

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

            var batches = t.Batch(items);

            Assert.AreEqual(1, batches.Count());
            Assert.AreEqual(1, batches.First().Count());
        }
        public void BatchDictionaryThousandsDifferentPartitions()
        {
            var random = new Random();
            var count  = random.Next(2001, 10000);
            var items  = new List <IDictionary <string, object> >();

            for (var i = 0; i < count; i++)
            {
                var dic = new Dictionary <string, object>();
                dic.Add(TableStorage.PartitionKey, Guid.NewGuid().ToString());
                items.Add(dic);
            }

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

            var batches = t.Batch(items);

            Assert.AreEqual(count, batches.Count());
        }
        public void BatchThousandsDifferentPartitions()
        {
            var random = new Random();
            var count  = random.Next(2001, 10000);
            var items  = new List <ITableEntity>();

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

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

            var batches = t.Batch(items);

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