Пример #1
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 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 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;
        }
Пример #4
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 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;
        }
Пример #6
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 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 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;
        }
Пример #9
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 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;
            }
        }
Пример #12
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)];
        }