public FixtureForUpdatingBatchsOfRecords()
        {
            // ARRANGE
            TableClient = GetTableClient();
            Table = CreateTable();

            var tasks = Enumerable.Range(0, 600).Select(i =>
            {
                var op = TableOperation.Insert(new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));
                return Table.ExecuteAsync(op);
            });

            Task.WhenAll(tasks).Wait();

            var tableQuery = new TableQuery<TestingEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "partitionKey"));

            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            Result = subject.BatchUpdateAsync(
                tableQuery,
                entities =>
                {
                    entities.ForEach(e => e.MyProperty = "Test");
                }).Result;
        }
예제 #2
0
        public FixtureForFindingOneRecord()
        {
            ExpectedEntity = new TestingEntity();
            var subject = new TsSet <TestingEntity>(new FakeTsTable <TestingEntity>(new[] { ExpectedEntity }));

            // ACT
            ActualEntity = subject.FindAsync(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey).Result;
        }
        public FixtureForFindingOneRecord()
        {
            ExpectedEntity = new TestingEntity();
            var subject = new TsSet<TestingEntity>(new FakeTsTable<TestingEntity>(new[] {ExpectedEntity}));

            // ACT
            ActualEntity = subject.FindAsync(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey).Result;
        }
        public FixtureForFindingOneRecord()
        {
            TableClient = GetTableClient();
            Table = CreateTable();
            ExpectedEntity = CreateEntity();
            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            ActualEntity = subject.FindAsync(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey).Result;
        }
        public FixtureForCreatingRecords()
        {
            ExpectedEntity = new TestingEntity();
            var fakeTsTable = new FakeTsTable<TestingEntity>(new List<TestingEntity>());
            var subject = new TsSet<TestingEntity>(fakeTsTable);

            // ACT
            subject.AddAsync(ExpectedEntity).Wait();

            ActualEntity = fakeTsTable.Entities[new Tuple<string, string>(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey)];
        }
예제 #6
0
        public FixtureForCreatingRecords()
        {
            ExpectedEntity = new TestingEntity();
            var fakeTsTable = new FakeTsTable <TestingEntity>(new List <TestingEntity>());
            var subject     = new TsSet <TestingEntity>(fakeTsTable);

            // ACT
            subject.AddAsync(ExpectedEntity).Wait();

            ActualEntity = fakeTsTable.Entities[new Tuple <string, string>(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey)];
        }
        public FixtureForDeletingRecords()
        {
            // ARRANGE
            TableClient = GetTableClient();
            Table = CreateTable();
            Entity = CreateEntity();
            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            subject.DeleteAsync(Entity).Wait();
        }
예제 #8
0
        public FixtureForDeletingBatchsOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600)
                       .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            _fakeTsTable = new FakeTsTable <TestingEntity>(seed);
            var subject = new TsSet <TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchDeleteAsync(new FindByPartitionKey("partitionKey")).Result;
        }
        public FixtureForCreatingBatchsOfRecords()
        {
            // ARRANGE
            var testingEntites = Enumerable.Range(0, 600)
                .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            _fakeTsTable = new FakeTsTable<TestingEntity>(new List<TestingEntity>());
            var subject = new TsSet<TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchAddAsync(testingEntites.ToList()).Result;
        }
        public FixtureForDeletingBatchsOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600)
                .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            _fakeTsTable = new FakeTsTable<TestingEntity>(seed);
            var subject = new TsSet<TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchDeleteAsync(new FindByPartitionKey("partitionKey")).Result;
        }
예제 #11
0
        public FixtureForCreatingBatchsOfRecords()
        {
            // ARRANGE
            var testingEntites = Enumerable.Range(0, 600)
                                 .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            _fakeTsTable = new FakeTsTable <TestingEntity>(new List <TestingEntity>());
            var subject = new TsSet <TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchAddAsync(testingEntites.ToList()).Result;
        }
        public FixtureForCreatingRecords()
        {
            TableClient = GetTableClient();
            Table = CreateTable();

            ExpectedEntity = new TestingEntity();
            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            subject.AddAsync(ExpectedEntity).Wait();

            ActualEntity = GetEntity(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey);
        }
예제 #13
0
        public FixtureForQueryingMultipleRecords()
        {
            // ARRANGE
            var testingEntities = new List <TestingEntity>();

            PropertyValue = Guid.NewGuid().ToString("N");
            testingEntities.AddRange(CreateListOfEntities(50, PropertyValue));
            testingEntities.AddRange(CreateListOfEntities(150));

            var subject = new TsSet <TestingEntity>(new FakeTsTable <TestingEntity>(testingEntities));

            Results = subject.QueryAsync(new FindByMyPropertyQuery(PropertyValue)).Result;
        }
        public FixtureForQueryingMultipleRecords()
        {
            // ARRANGE
            var testingEntities = new List<TestingEntity>();

            PropertyValue = Guid.NewGuid().ToString("N");
            testingEntities.AddRange(CreateListOfEntities(50, PropertyValue));
            testingEntities.AddRange(CreateListOfEntities(150));

            var subject = new TsSet<TestingEntity>(new FakeTsTable<TestingEntity>(testingEntities));

            Results = subject.QueryAsync(new FindByMyPropertyQuery(PropertyValue)).Result;
        }
        public FixtureForQueryingMultipleRecords()
        {
            // ARRANGE
            TableClient = GetTableClient();
            Table = CreateTable();

            PropertyValue = Guid.NewGuid().ToString("N");
            CreateListOfEntities(50, PropertyValue);
            CreateListOfEntities(150);

            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            Results = subject.QueryAsync(new FindByMyPropertyQuery(PropertyValue)).Result;
        }
        public FixtureForUpdatingBatchsOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600).Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            var tableQuery = new TableQuery<TestingEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "partitionKey"));

            _fakeTsTable = new FakeTsTable<TestingEntity>(seed);
            var subject = new TsSet<TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchUpdateAsync(
                tableQuery,
                entities =>
                {
                    entities.ForEach(e => e.MyProperty = "Test");
                }).Result;
        }
        public FixtureForProcessingABatchOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600)
                    .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            var subject = new TsSet<TestingEntity>(new FakeTsTable<TestingEntity>(seed));

            // ACT
            MyProperties = new List<string>();
            Result = subject.BatchProcessAsync(
                new FindByPartitionKey("partitionKey"),
                entities =>
                {
                    MyProperties.AddRange(entities.Select(f => f.MyProperty));
                    return Task.Delay(0);
                }).Result;
        }
        public FixtureForUpdatingBatchsOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600).Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            var tableQuery = new TableQuery <TestingEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "partitionKey"));

            _fakeTsTable = new FakeTsTable <TestingEntity>(seed);
            var subject = new TsSet <TestingEntity>(_fakeTsTable);

            // ACT
            Result = subject.BatchUpdateAsync(
                tableQuery,
                entities =>
            {
                entities.ForEach(e => e.MyProperty = "Test");
            }).Result;
        }
예제 #19
0
        public FixtureForProcessingABatchOfRecords()
        {
            // ARRANGE
            var seed = Enumerable.Range(0, 600)
                       .Select(i => new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));

            var subject = new TsSet <TestingEntity>(new FakeTsTable <TestingEntity>(seed));

            // ACT
            MyProperties = new List <string>();
            Result       = subject.BatchProcessAsync(
                new FindByPartitionKey("partitionKey"),
                entities =>
            {
                MyProperties.AddRange(entities.Select(f => f.MyProperty));
                return(Task.Delay(0));
            }).Result;
        }
        public FixtureForDeletingBatchsOfRecords()
        {
            // ARRANGE
            TableClient = GetTableClient();
            Table = CreateTable();

            var tasks = Enumerable.Range(0, 600).Select(i =>
            {
                var op = TableOperation.Insert(new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));
                return Table.ExecuteAsync(op);
            });

            Task.WhenAll(tasks).Wait();

            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            Result = subject.BatchDeleteAsync(new FindByPartitionKey("partitionKey")).Result;
        }
예제 #21
0
        public FixtureForDeletingRecords()
        {
            // ARRANGE
            Entity = new TestingEntity();
            var fakeTsTable = new FakeTsTable <TestingEntity>(new[] { Entity });
            var subject     = new TsSet <TestingEntity>(fakeTsTable);

            // ACT
            subject.DeleteAsync(Entity).Wait();

            try
            {
                ActualEntity = fakeTsTable.Entities[new Tuple <string, string>(Entity.PartitionKey, Entity.RowKey)];
            }
            catch (Exception)
            {
                ActualEntity = null;
            }
        }
        public FixtureForUpdatingRecords()
        {
            var originalEntity = new TestingEntity();
            ExpectedEntity = new TestingEntity
            {
                PartitionKey = originalEntity.PartitionKey,
                RowKey = originalEntity.RowKey,
                ETag = originalEntity.ETag,
                Timestamp = originalEntity.Timestamp,
                MyProperty = Guid.NewGuid().ToString("N")
            };

            var fakeTsTable = new FakeTsTable<TestingEntity>(new[] { originalEntity });
            var subject = new TsSet<TestingEntity>(fakeTsTable);

            // ACT
            subject.UpdateAsync(ExpectedEntity).Wait();
            ActualEntity = fakeTsTable.Entities[new Tuple<string, string>(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey)];
        }
        public FixtureForCreatingBatchsOfRecords()
        {
            // ARRANGE
            TableClient = GetTableClient();
            Table = CreateTable();

            var testingEntites = new List<TestingEntity>();

            for (var i = 0; i < 600; i++)
            {
                testingEntites.Add(
                    new TestingEntity("partitionKey", Guid.NewGuid().ToString(), Guid.NewGuid().ToString()));
            }

            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            Result = subject.BatchAddAsync(testingEntites).Result;
        }
        public FixtureForDeletingRecords()
        {
            // ARRANGE
            Entity = new TestingEntity();
            var fakeTsTable = new FakeTsTable<TestingEntity>(new[] {Entity});
            var subject = new TsSet<TestingEntity>(fakeTsTable);

            // ACT
            subject.DeleteAsync(Entity).Wait();

            try
            {
                ActualEntity = fakeTsTable.Entities[new Tuple<string, string>(Entity.PartitionKey, Entity.RowKey)];
            }
            catch (Exception)
            {
                ActualEntity = null;
            }
        }
예제 #25
0
        public FixtureForUpdatingRecords()
        {
            var originalEntity = new TestingEntity();

            ExpectedEntity = new TestingEntity
            {
                PartitionKey = originalEntity.PartitionKey,
                RowKey       = originalEntity.RowKey,
                ETag         = originalEntity.ETag,
                Timestamp    = originalEntity.Timestamp,
                MyProperty   = Guid.NewGuid().ToString("N")
            };

            var fakeTsTable = new FakeTsTable <TestingEntity>(new[] { originalEntity });
            var subject     = new TsSet <TestingEntity>(fakeTsTable);

            // ACT
            subject.UpdateAsync(ExpectedEntity).Wait();
            ActualEntity = fakeTsTable.Entities[new Tuple <string, string>(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey)];
        }
        public FixtureForUpdatingRecords()
        {
            TableClient = GetTableClient();
            Table = CreateTable();
            var originalEntity = CreateEntity();
            ExpectedEntity = new TestingEntity
            {
                PartitionKey = originalEntity.PartitionKey,
                RowKey = originalEntity.RowKey,
                ETag = originalEntity.ETag,
                Timestamp = originalEntity.Timestamp,
                MyProperty = Guid.NewGuid().ToString("N")
            };

            var subject = new TsSet<TestingEntity>(new TsTable<TestingEntity>(Table));

            // ACT
            subject.UpdateAsync(ExpectedEntity).Wait();
            ActualEntity = GetEntity(ExpectedEntity.PartitionKey, ExpectedEntity.RowKey);
        }