public async Task AddOrUpdateMany()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row1       = new TestRow {
                PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1", ETag = "*"
            };
            var row2 = new TestRow {
                PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2", ETag = "*"
            };

            await azureTable.DeleteAsync(new[] { row1, row2 });

            var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany");

            Assert.AreEqual(0, rowsToDelete.Count());

            await azureTable.AddAsync(row1);

            var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany");

            Assert.AreEqual(1, actualRows.Count());

            row1.Content = "content modified";
            await azureTable.AddOrUpdateAsync(new[] { row1, row2 });

            var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany");

            Assert.AreEqual(2, insertedRows.Count());

            TestRow updatedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateMany", row1.RowKey);

            Assert.IsNotNull(updatedRow);
            Assert.AreEqual("content modified", updatedRow.Content);
        }
Пример #2
0
        public void SaveManyAndDeleteMany()
        {
            var account    = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row1       = new TestRow {
                PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany"
            };
            var row2 = new TestRow {
                PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany"
            };

            azureTable.Delete(new[] { row1, row2 });
            var rowsToDelete = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                                select o).ToList();

            Assert.AreEqual(0, rowsToDelete.Count);

            azureTable.Add(new[] { row1, row2 });
            var insertedRows = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                                select o).ToList();

            Assert.AreEqual(2, insertedRows.Count);

            azureTable.Delete(new[] { row1, row2 });
            var actualRows = (from o in azureTable.Query
                              where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                              select o).ToList();

            Assert.AreEqual(0, actualRows.Count);
        }
Пример #3
0
        public void SaveConfigurationNullsUserAndToken()
        {
            var user      = new UserData(StringHelper.ValidString(), StringHelper.ValidString(), StringHelper.ValidString());
            var userTable = new AzureTable <UserData>(CloudStorageAccount.DevelopmentStorageAccount);

            userTable.AddEntity(user);
            var userApp = new UserApplicationData(user.Id, user.ApplicationId)
            {
                Active = true
            };
            var table = new AzureTable <UserApplicationData>(CloudStorageAccount.DevelopmentStorageAccount);

            table.AddEntity(userApp);

            var core   = new ApplicationCore();
            var config = this.Config(userApp.ApplicationId);

            var u = new User()
            {
                Identifier = userApp.UserId,
            };
            var a = new Application()
            {
                Identifier = user.ApplicationId,
            };
            var editor = new UserApplication()
            {
                User        = u,
                Application = a,
            };
            var returned = core.Save(config, editor);

            Assert.IsNotNull(returned);
            Assert.IsNull(returned.Token);
        }
Пример #4
0
        public void ApplicationCount()
        {
            var userId        = Guid.NewGuid();
            var table         = new AzureTable <ApplicationInfoData>(CloudStorageAccount.DevelopmentStorageAccount);
            var random        = new Random();
            var expectedCount = random.Next(15);

            for (int i = 0; i < expectedCount; i++)
            {
                var ua = new ApplicationInfoData(Guid.NewGuid())
                {
                    Owner = userId,
                };

                table.AddOrUpdateEntity(ua);
            }

            var user = new User()
            {
                Identifier = userId,
            };

            var appCore = new ApplicationCore();
            var count   = appCore.ApplicationCount(user);

            Assert.AreEqual <int>(expectedCount, count);
        }
Пример #5
0
        public void DeleteAndAddAndGet()
        {
            var account    = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row        = new TestRow
            {
                PartitionKey = "partition_key_DeleteAndAddAndGet",
                RowKey       = "row_key_DeleteAndAddAndGet",
                Content      = "content"
            };

            azureTable.Delete(row);
            TestRow deletedRow = (from o in azureTable.Query
                                  where o.RowKey == row.RowKey
                                  select o).SingleOrDefault();

            Assert.IsNull(deletedRow);

            azureTable.Add(row);
            TestRow savedRow = (from o in azureTable.Query
                                where o.RowKey == row.RowKey &&
                                o.PartitionKey == "partition_key_DeleteAndAddAndGet" &&
                                o.Content == "content"
                                select o).SingleOrDefault();

            Assert.IsNotNull(savedRow);

            azureTable.Delete(row);
            TestRow actualRow = (from o in azureTable.Query
                                 where o.RowKey == row.RowKey
                                 select o).SingleOrDefault();

            Assert.IsNull(actualRow);
        }
Пример #6
0
        public void LogEventItem()
        {
            var logs  = EventLog.GetEventLogs();
            var log   = logs.FirstOrDefault();
            var entry = log.Entries[0];

            Logger.Log(entry);

            Trace.Flush();
            Thread.Sleep(1250);

            var app    = new Application();
            var table  = new AzureTable <Abc.Services.Data.EventLogRow>(CloudStorageAccount.DevelopmentStorageAccount);
            var events = table.QueryByPartition(app.Token.ApplicationId.ToString());

            Assert.IsNotNull(events);

            var entryRow = (from data in events
                            where data.InstanceId == entry.InstanceId &&
                            data.MachineName == entry.MachineName &&
                            data.Source == entry.Source
                            select data).FirstOrDefault();

            Assert.IsNotNull(entryRow);
            Assert.AreEqual <Guid>(Application.Identifier, entryRow.ApplicationId);
            Assert.AreEqual <string>(entry.MachineName, entryRow.MachineName);

            // Can't test due to line breaks.
            ////Assert.AreEqual<string>(entry.Message, entryRow.Message);
            Assert.AreEqual <string>(entry.Source, entryRow.Source);
            Assert.AreEqual <int>((int)entry.EntryType, entryRow.EntryTypeValue);
            Assert.AreEqual <long?>(entry.InstanceId, entryRow.InstanceId);
        }
Пример #7
0
        public void Load(object value)
        {
            this.logger.Log("Loading configuration from data store.");

            var table = new AzureTable <ApplicationConfiguration>(ServerConfiguration.Default);

            var data     = table.QueryByPartition(this.applicationIdentifier.ToString());
            var settings = data.ToList().AsParallel().Select(d => d.Convert());

            if (0 < settings.Count())
            {
                var config = new Dictionary <string, string>(this.configuration.Count);
                foreach (var setting in settings)
                {
                    if (!config.ContainsKey(setting.Key))
                    {
                        config.Add(setting.Key, setting.Value);
                    }
                    else
                    {
                        this.logger.Log("Key is already present in dictionary: '{0}', first value was used '{1}'.".FormatWithCulture(setting.Key, config[setting.Key]));
                    }
                }

                this.configuration = config;
            }
            else
            {
                this.logger.Log("No settings being loaded from data store.");
            }
        }
Пример #8
0
        public void ProcessResponseSuccessful()
        {
            var random  = new Random();
            var payment = new PayPalPaymentConfirmation()
            {
                Application = new Application()
                {
                    Identifier = Guid.NewGuid(),
                },
                User = new User()
                {
                    Identifier = Guid.NewGuid(),
                },
                TransactionId = random.Next().ToString(),
                Response      = PayPalResponseValue,
            };

            payment = PaymentCore.ProcessResponse(payment);

            var table = new AzureTable <PayPalPaymentConfirmationRow>(ServerConfiguration.Default);
            var row   = table.QueryByPartition(payment.Application.Identifier.ToString()).First();

            Assert.AreEqual <string>(payment.FirstName, row.FirstName);
            Assert.AreEqual <string>(payment.LastName, row.LastName);
            Assert.AreEqual <string>(payment.PaymentStatusFromPayPal, row.PaymentStatusFromPayPal);
            Assert.AreEqual <string>(payment.Email, row.Email);
            Assert.AreEqual <string>(payment.Gross, row.Gross);
            Assert.AreEqual <string>(payment.CurrencyCode, row.CurrencyCode);
            Assert.AreEqual <string>(payment.Custom, row.Custom);
            Assert.IsTrue(payment.Successful);
            Assert.IsTrue(row.Successful);
        }
        public static void Initialize(TestContext context)
        {
            account = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
            var azureTable = new AzureTable <TestRow>(account, TableName);

            azureTable.EnsureExistsAsync().Wait();
        }
        public void Query()
        {
            var table = new AzureTable <MessageData>(CloudStorageAccount.DevelopmentStorageAccount);

            var appId = Guid.NewGuid();

            for (int i = 0; i < 4; i++)
            {
                var data = new MessageData(appId);
                data.Fill();

                table.AddEntity(data);
            }

            var query = new LogQuery()
            {
                ApplicationIdentifier = appId,
                From = DateTime.UtcNow.AddMinutes(-1),
                To   = DateTime.UtcNow.AddMilliseconds(1),
                Top  = 1,
            };

            var messages = table.Query <MessageData>(query).ToList();

            Assert.IsNotNull(messages, "Message data should not be null.");
            Assert.AreEqual <int>(1, messages.Count(), "1 Message Should be contained.");

            query.Top = 3;

            messages = table.Query <MessageData>(query).ToList();
            Assert.IsNotNull(messages, "Message data should not be null.");
            Assert.AreEqual <int>(3, messages.Count(), "3 Message Should be contained.");
        }
Пример #11
0
        public void CreateNewInstance()
        {
            var account    = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable <TestRow>(account);

            Assert.IsInstanceOfType(azureTable, typeof(AzureTable <TestRow>));
        }
        public async Task SaveManyAndDeleteMany()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row1       = new TestRow {
                PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany", ETag = "*"
            };
            var row2 = new TestRow {
                PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany", ETag = "*"
            };

            await azureTable.DeleteAsync(new[] { row1, row2 });

            var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany");

            Assert.AreEqual(0, rowsToDelete.Count());

            row1.ETag = string.Empty;
            row2.ETag = string.Empty;
            await azureTable.AddAsync(new[] { row1, row2 });

            var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany");

            Assert.AreEqual(2, insertedRows.Count());

            await azureTable.DeleteAsync(new[] { row1, row2 });

            var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany");

            Assert.AreEqual(0, actualRows.Count());
        }
Пример #13
0
        public void Save(User user, string tribe)
        {
            if (null == user)
            {
                throw new ArgumentNullException("user");
            }

            if (string.IsNullOrWhiteSpace(tribe))
            {
                throw new ArgumentException("tribe");
            }

            if (Guid.Empty == user.Identifier)
            {
                throw new ArgumentException();
            }

            var table    = new AzureTable <UserTribesRow>(ServerConfiguration.Default);
            var tribeRow = new UserTribesRow()
            {
                PartitionKey = tribe,
                RowKey       = user.Identifier.ToString(),
            };
            var userRow = new UserTribesRow()
            {
                PartitionKey = user.Identifier.ToString(),
                RowKey       = tribe,
            };
        }
Пример #14
0
        public ContactGroup Save(ContactGroup contact)
        {
            Contract.Requires <ArgumentNullException>(null != contact);
            Contract.Requires <ArgumentNullException>(null != contact.Owner);
            Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != contact.Identifier);
            Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != contact.Owner.Identifier);

            using (new PerformanceMonitor())
            {
                var row   = contact.Convert();
                var table = new AzureTable <ContactGroupRow>(ServerConfiguration.Default, new ContactGroupRowValidator());
                var data  = table.QueryBy(row.PartitionKey, row.RowKey);

                if (null == data)
                {
                    table.AddEntity(row);
                }
                else
                {
                    data.Name = row.Name;
                    table.AddOrUpdateEntity(data);

                    row = data;
                }

                return(row.Convert());
            }
        }
        public async Task GetByPartitionKey_Returns_SpecificEntities()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row1       = new TestRow {
                PartitionKey = "partition_key_1_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_1_GetByPartitionKey_Returns_SpecificEntities", Content = "content 1", ETag = "*"
            };
            var row2 = new TestRow {
                PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_2_GetByPartitionKey_Returns_SpecificEntities", Content = "content 2", ETag = "*"
            };
            var row3 = new TestRow {
                PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_3_GetByPartitionKey_Returns_SpecificEntities", Content = "content 3", ETag = "*"
            };

            await azureTable.DeleteAsync(row1);

            await azureTable.DeleteAsync(row2);

            await azureTable.DeleteAsync(row3);

            await azureTable.AddAsync(row1);

            await azureTable.AddAsync(row2);

            await azureTable.AddAsync(row3);

            var retrievedRows = await azureTable.GetByPartitionKeyAsync("partition_key_2_GetByPartitionKey_Returns_SpecificEntities");

            Assert.AreEqual(2, retrievedRows.Count());
            Assert.AreEqual(row2.Content, retrievedRows.ToList()[0].Content);
        }
Пример #16
0
        public static WorkEntity Create(AzureTable table, MusicRecordingDTO work)
        {
            var workEntity = new WorkEntity(table);

            workEntity.Initialise(work);
            return(workEntity);
        }
        public async Task AddOrUpdateUpdatesWhenExists()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);

            var row = new TestRow
            {
                PartitionKey = "partition_key_AddOrUpdateUpdatesWhenExists",
                RowKey       = "row_key_AddOrUpdateUpdatesWhenExists",
                Content      = "content"
            };

            await azureTable.DeleteAsync(row);

            TestRow deletedRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault();

            Assert.IsNull(deletedRow);

            await azureTable.AddAsync(row);

            TestRow savedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateUpdatesWhenExists", row.RowKey);

            Assert.IsNotNull(savedRow);
            Assert.AreEqual("content", savedRow.Content);

            row.Content = "content modified";
            await azureTable.AddOrUpdateAsync(row);

            TestRow updatedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateUpdatesWhenExists", row.RowKey);

            Assert.IsNotNull(updatedRow);
            Assert.AreEqual("content modified", updatedRow.Content);
        }
Пример #18
0
        public void AddOrUpdateAddsWhenNotExists()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");

            var azureTable = new AzureTable<TestRow>(account, TableName);
            azureTable.RetryPolicyFactory = new DefaultRetryPolicyFactory();

            var row = new TestRow
            {
                PartitionKey = "partition_key_AddOrUpdateAddsWhenNotExists",
                RowKey = "row_key_AddOrUpdateAddsWhenNotExists",
                Content = "content"
            };

            azureTable.Delete(row);
            TestRow deletedRow = (from o in azureTable.Query
                                  where o.RowKey == row.RowKey
                                  select o).SingleOrDefault();
            Assert.IsNull(deletedRow);

            azureTable.AddOrUpdate(row);
            TestRow savedRow = (from o in azureTable.Query
                                where o.RowKey == row.RowKey &&
                                      o.PartitionKey == "partition_key_AddOrUpdateAddsWhenNotExists" &&
                                      o.Content == "content"
                                select o).SingleOrDefault();
            Assert.IsNotNull(savedRow);
        }
Пример #19
0
        public void AddOrUpdateMany()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable<TestRow>(account, TableName);
            var row1 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1" };
            var row2 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2" };

            azureTable.Delete(new[] { row1, row2 });
            var rowsToDelete = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_AddOrUpdateMany"
                                select o).ToList();
            Assert.AreEqual(0, rowsToDelete.Count);

            azureTable.Add(row1);
            var actualRows = (from o in azureTable.Query
                              where o.PartitionKey == "partition_key_AddOrUpdateMany"
                              select o).ToList();
            Assert.AreEqual(1, actualRows.Count);

            row1.Content = "content modified";
            azureTable.AddOrUpdate(new[] { row1, row2 });
            var insertedRows = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_AddOrUpdateMany"
                                select o).ToList();
            Assert.AreEqual(2, insertedRows.Count);

            TestRow updatedRow = (from o in azureTable.Query
                                  where o.RowKey == row1.RowKey &&
                                        o.PartitionKey == "partition_key_AddOrUpdateMany" &&
                                        o.Content == "content modified"
                                  select o).SingleOrDefault();
            Assert.IsNotNull(updatedRow);
        }
        public void LogServerStatisticSetNullNetwork()
        {
            var stat = this.ServerStats();

            stat.NetworkPercentages = null;
            using (var client = new DatumClient())
            {
                client.LogServerStatisticSet(stat);
            }

            var table = new AzureTable <Abc.Services.Data.ServerStatisticsRow>(ServerConfiguration.Default);
            var row   = (from data in table.QueryByPartition(stat.Token.ApplicationId.ToString())
                         where data.MachineName == stat.MachineName
                         select data).First();

            Assert.IsNotNull(row);
            Assert.AreEqual <Guid>(stat.Token.ApplicationId, row.ApplicationId, "Application Id should match");
            Assert.AreEqual <DateTime>(stat.OccurredOn.Date, row.OccurredOn.Date, "Occured On should match");
            Assert.AreEqual <string>(stat.MachineName, row.MachineName, "Machine Name should match");
            Assert.AreEqual <double>(stat.CpuUsagePercentage, row.CpuUsagePercentage);
            Assert.AreEqual <double>(stat.PhysicalDiskUsagePercentage, row.PhysicalDiskUsagePercentage);
            Assert.AreEqual <double>(stat.MemoryUsagePercentage, row.MemoryUsagePercentage);
            Assert.IsNull(stat.NetworkPercentages);
            Assert.IsNull(row.NetworkPercentage1);
            Assert.IsNull(row.NetworkPercentage2);
            Assert.IsNull(row.NetworkPercentage3);
            Assert.IsNull(row.NetworkPercentage4);
        }
Пример #21
0
        public void AddOrUpdateAddsWhenNotExists()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");

            var azureTable = new AzureTable <TestRow>(account, TableName);

            azureTable.RetryPolicyFactory = new DefaultRetryPolicyFactory();

            var row = new TestRow
            {
                PartitionKey = "partition_key_AddOrUpdateAddsWhenNotExists",
                RowKey       = "row_key_AddOrUpdateAddsWhenNotExists",
                Content      = "content"
            };

            azureTable.Delete(row);
            TestRow deletedRow = (from o in azureTable.Query
                                  where o.RowKey == row.RowKey
                                  select o).SingleOrDefault();

            Assert.IsNull(deletedRow);

            azureTable.AddOrUpdate(row);
            TestRow savedRow = (from o in azureTable.Query
                                where o.RowKey == row.RowKey &&
                                o.PartitionKey == "partition_key_AddOrUpdateAddsWhenNotExists" &&
                                o.Content == "content"
                                select o).SingleOrDefault();

            Assert.IsNotNull(savedRow);
        }
Пример #22
0
        public static void Initialize(TestContext context)
        {
            var account    = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable <TestRow>(account, TableName);

            azureTable.EnsureExist();
        }
        public void Delete_Table_Entity()
        {
            CleanupTable("test6");

            IAzureTable <TestTableEntity> testTable = new AzureTable <TestTableEntity>(CloudStorageAccount.DevelopmentStorageAccount, "test6");


            var entity = new TestTableEntity
            {
                PartitionKey = "partitionkey",
                RowKey       = Guid.NewGuid().ToString(),
                Name         = "testname",
                Price        = 10
            };

            testTable.Insert(entity);

            var retrievedEntities = testTable.Query.Where(x => x.PartitionKey == "partitionkey").ToList();

            Assert.AreEqual(1, retrievedEntities.Count);

            testTable.Delete(entity);

            var retrievedEntities2 = testTable.Query.Where(x => x.PartitionKey == "partitionkey").ToList();

            Assert.AreEqual(0, retrievedEntities2.Count);
        }
        public void LogEventItem()
        {
            var item = this.EventLog;

            using (var client = new DatumClient())
            {
                client.LogEventItem(item);
            }

            var table = new AzureTable <Server.Data.EventLogRow>(CloudStorageAccount.DevelopmentStorageAccount);

            var returned = (from data in table.QueryByPartition(item.Token.ApplicationId.ToString())
                            where item.Message == data.Message
                            select data).FirstOrDefault();

            Assert.IsNotNull(returned, "Event Log Item should not be null");
            Assert.AreEqual <string>(item.Source, returned.Source);
            Assert.AreEqual <string>(item.MachineName, returned.MachineName);
            Assert.AreEqual <string>(item.Message, returned.Message);
            Assert.AreEqual <DateTime>(item.OccurredOn.Date, returned.OccurredOn.Date);
            Assert.AreEqual <Guid>(item.Token.ApplicationId, returned.ApplicationId);
            Assert.AreEqual <string>(item.DeploymentId, returned.DeploymentId);
            Assert.AreEqual <string>(item.User, returned.User);
            Assert.AreEqual <int?>(item.EventId, returned.EventId);
            Assert.AreEqual <long?>(item.InstanceId, returned.InstanceId);
            Assert.AreEqual <int>((int)item.EntryType, returned.EntryTypeValue);
        }
Пример #25
0
        /// <summary>
        /// Gets a single random Map from Azure storage.
        /// </summary>
        /// <param name="table">The Azure table to use.</param>
        /// <param name="previous">A Map row key to avoid selecting.</param>
        /// <returns>A random Map.</returns>
        public static async Task <MapEntity> GetRandomMap(this AzureTable <MapEntity> table, string previous = "")
        {
            Guard.NotNull(() => table);
            Guard.NotNull(() => previous);

            var queryConditions = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, MapEntity.MainKey),
                TableOperators.And,
                TableQuery.GenerateFilterConditionForBool("IsActive", QueryComparisons.Equal, true));

            var query = new TableQuery <MapEntity>().Where(queryConditions);

            var maps = await table.GetFromQuery(query);

            if (maps.Count() == 0)
            {
                return(default(MapEntity));
            }

            int randomIndex = random.Next(maps.Count());

            var storedMap = maps.ElementAt(randomIndex);

            if (!string.IsNullOrEmpty(previous) && storedMap.RowKey == previous)
            {
                storedMap = maps.ElementAt(random.Next(maps.Count()));
            }

            return(storedMap);
        }
        public void LogError()
        {
            var err = this.Error();

            using (var client = new DatumClient())
            {
                client.LogException(err);
            }

            var app    = new Application();
            var table  = new AzureTable <Server.ErrorData>(CloudStorageAccount.DevelopmentStorageAccount);
            var errors = table.QueryByPartition(err.Token.ApplicationId.ToString()).ToList();

            Assert.IsNotNull(errors, "Errors should not be null");
            var error = (from data in errors
                         where err.Message == data.Message
                         select data).FirstOrDefault();

            Assert.IsNotNull(error, "Error should not be null");
            Assert.AreEqual <Guid>(err.Token.ApplicationId, error.ApplicationId, "Application Id should match");
            Assert.AreEqual <DateTime>(err.OccurredOn.Date, error.OccurredOn.Date, "Occured On should match");
            Assert.AreEqual <string>(err.MachineName, error.MachineName, "Machine Name should match");
            Assert.AreEqual <string>(err.Message, error.Message, "Message should match");
            Assert.AreEqual <string>(err.ClassName, error.ClassName, "Type should match");
            Assert.AreEqual <int>(err.ErrorCode, error.ErrorCode, "Error Code should match");
            Assert.AreEqual <int>((int)err.EventType, error.EventTypeValue, "Event Type should match");
        }
Пример #27
0
        public string SetRoles(Application app, Guid userId)
        {
            Contract.Requires <ArgumentNullException>(null != app);
            Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != app.Identifier);
            Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != userId);

            using (new PerformanceMonitor())
            {
                var userInfo = this.userTable.QueryBy(app.Identifier.ToString(), userId.ToString());

                if (null != userInfo)
                {
                    IList <RoleRow> roles = new List <RoleRow>(2);
                    if (userInfo.Email.ToUpperInvariant().EndsWith("@agilebusinesscloud.com".ToUpperInvariant()))
                    {
                        userInfo.RoleValue = (int)RoleType.Manager;
                        var staff = new RoleRow(app.Identifier)
                        {
                            UserIdentifier = userInfo.Id,
                            Name           = "staff",
                        };

                        roles.Add(staff);
                    }

                    var member = new RoleRow(app.Identifier)
                    {
                        UserIdentifier = userInfo.Id,
                        Name           = "member",
                    };

                    roles.Add(member);

                    var roleTable = new AzureTable <RoleRow>(ServerConfiguration.Default, new RoleRowValidator());
                    roleTable.AddEntity(roles);

                    var preference = new UserPreference()
                    {
                        Application = app,
                        User        = userInfo.Convert(),
                        MaximumAllowedApplications = 1,
                    };

                    var userCore = new UserCore();
                    userCore.Save(preference);

                    userInfo.EmailValidated = true;
                    userInfo.LastActivityOn = DateTime.UtcNow;
                    this.userTable.AddOrUpdateEntity(userInfo);

                    return(userInfo.Email);
                }
                else
                {
                    Logging.Log("Email validation key not found.");
                }

                return(null);
            }
        }
Пример #28
0
        public static PayPalPaymentConfirmation ProcessResponse(PayPalPaymentConfirmation payment)
        {
            Contract.Requires <ArgumentNullException>(null != payment);

            if (string.IsNullOrWhiteSpace(payment.Response))
            {
                log.Log("Empty response returned from PayPal.");
            }
            else if (payment.Response.StartsWith("SUCCESS", StringComparison.InvariantCultureIgnoreCase))
            {
                payment.Successful = true;

                payment = PaymentCore.ProcessSuccessfulResponse(payment);

                var preferenceTable = new AzureTable <UserPreferenceRow>(ServerConfiguration.Default);
                var preference      = preferenceTable.QueryBy(payment.Application.Identifier.ToString(), payment.User.Identifier.ToString());

                preference = preference ?? new UserPreferenceRow(payment.Application.Identifier, payment.User.Identifier);

                preference.MaxiumAllowedApplications = preference.MaxiumAllowedApplications.HasValue ? preference.MaxiumAllowedApplications + 1 : 1;
                preferenceTable.AddOrUpdateEntity(preference);
            }
            else
            {
                payment.Successful = false;

                log.Log("Error Accepting payment response.");
            }

            var table = new AzureTable <PayPalPaymentConfirmationRow>(ServerConfiguration.Default);

            table.AddEntity(payment.Convert());

            return(payment);
        }
        public async Task GetByPartitionRowKey_Returns_SpecificEntity()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row1       = new TestRow {
                PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_1_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 1", ETag = "*"
            };
            var row2 = new TestRow {
                PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 2", ETag = "*"
            };
            var row3 = new TestRow {
                PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_3_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 3", ETag = "*"
            };

            await azureTable.DeleteAsync(new[] { row1, row2, row3 });

            var rowsToDelete = await azureTable.GetByPartitionKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity");

            Assert.AreEqual(0, rowsToDelete.Count());

            await azureTable.AddAsync(new[] { row1, row2, row3 });

            var retrievedRow = await azureTable.GetByPartitionRowKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity", "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity");

            Assert.AreEqual(row2.Content, retrievedRow.Content);
        }
Пример #30
0
        public void LogError()
        {
            var logger  = new Logger();
            var message = Guid.NewGuid().ToString();
            var ex      = new Exception(message);

            logger.Log(ex, Logging.EventTypes.Suspend, 9879);

            Trace.Flush();
            Thread.Sleep(1250);

            var app    = new Application();
            var table  = new AzureTable <ErrorData>(CloudStorageAccount.DevelopmentStorageAccount);
            var errors = table.QueryByPartition(app.Token.ApplicationId.ToString());

            Assert.IsNotNull(errors, "Errors should not be null");
            var error = (from data in errors
                         where ex.Message == data.Message
                         select data).FirstOrDefault();

            Assert.IsNotNull(error, "Error should not be null");
            Assert.AreEqual <Guid>(Application.Identifier, error.ApplicationId, "Application Id should match");
            Assert.AreEqual <string>(System.Environment.MachineName, error.MachineName, "Machine Name should match");
            Assert.AreEqual <string>(ex.Message, error.Message, "Message should match");
            Assert.AreEqual <string>(ex.GetType().ToString(), error.ClassName, "Type should match");
            Assert.AreEqual <int>(9879, error.ErrorCode, "Error Code should match");
            Assert.AreEqual <int>((int)Logging.EventTypes.Suspend, error.EventTypeValue, "Event Type should match");
        }
        public async Task DeleteAndAddAndGet()
        {
            var azureTable = new AzureTable <TestRow>(account, TableName);
            var row        = new TestRow
            {
                PartitionKey = "partition_key_DeleteAndAddAndGet",
                RowKey       = "row_key_DeleteAndAddAndGet",
                Content      = "content"
            };

            await azureTable.DeleteAsync(row);

            TestRow deletedRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault();

            Assert.IsNull(deletedRow);

            await azureTable.AddAsync(row);

            TestRow savedRow = await azureTable.GetByPartitionRowKeyAsync(row.PartitionKey, row.RowKey);

            Assert.IsNotNull(savedRow);
            Assert.AreEqual("content", savedRow.Content);

            await azureTable.DeleteAsync(row);

            TestRow actualRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault();

            Assert.IsNull(actualRow);
        }
Пример #32
0
        public void ProcessResponseInvalid()
        {
            var random  = new Random();
            var payment = new PayPalPaymentConfirmation()
            {
                Application = new Application()
                {
                    Identifier = Guid.NewGuid(),
                },
                User = new User()
                {
                    Identifier = Guid.NewGuid(),
                },
                TransactionId = random.Next().ToString(),
                Response      = StringHelper.ValidString(),
            };

            payment = PaymentCore.ProcessResponse(payment);

            var table = new AzureTable <PayPalPaymentConfirmationRow>(ServerConfiguration.Default);
            var row   = table.QueryByPartition(payment.Application.Identifier.ToString()).First();

            Assert.IsFalse(payment.Successful);
            Assert.IsFalse(row.Successful);
        }
        public WebSiteRepository(AzureTable<WebSiteRow> webSiteTable, AzureTable<BindingRow> bindingTable)
        {
            this.webSiteTable = webSiteTable;
            this.bindingTable = bindingTable;

            this.webSiteTable.CreateIfNotExist();
            this.bindingTable.CreateIfNotExist();
        }
        public CertificateRepository(AzureTable<CertificateRow> certificateTable, AzureBlobContainer<byte[]> certificateBlobContainer, IWebSiteRepository webSiteRepository)
        {
            this.certificateTable = certificateTable;
            this.certificateBlobContainer = certificateBlobContainer;

            this.certificateTable.CreateIfNotExist();
            this.certificateBlobContainer.EnsureExist();

            this.webSiteRepository = webSiteRepository;
        }
Пример #35
0
 public ActionResult Index()
 {
     AzureTable<Customer> table = new AzureTable<Customer>(account);
     var customers = table.Query;
     if (Request.IsAjaxRequest())
     {
         return PartialView("_List", customers);
     }
     return View(customers);
 }
 public void Setup()
 {
     this.webSiteTable = new AzureTable<WebSiteRow>(CloudStorageAccount.DevelopmentStorageAccount, "WebSitesTest");
     this.bindingTable = new AzureTable<BindingRow>(CloudStorageAccount.DevelopmentStorageAccount, "BindingsTest");
     this.certificateRepository = new CertificateRepository(CloudStorageAccount.DevelopmentStorageAccount, "CertificatesTest", "certificatestest");
     this.webSiteTable.CreateIfNotExist();
     this.bindingTable.CreateIfNotExist();
     this.webSiteRepository = new WebSiteRepository(this.webSiteTable, this.bindingTable);
     this.controller = new WebSiteController(this.webSiteRepository, this.certificateRepository);
 }
        public void BulkInsert_Table_Entities()
        {
            CleanupTable("test3");

            IAzureTable<TestTableEntity> testTable = new AzureTable<TestTableEntity>(CloudStorageAccount.DevelopmentStorageAccount, "test3");
            

            var entities = new List<TestTableEntity>();

            for (var i = 0; i < 150; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            for (var i = 0; i < 30; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey2",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            for (var i = 0; i < 220; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey3",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            testTable.Insert(entities);

            var entitiesInTable = testTable.Query.ToList();

            Assert.AreEqual(400, entitiesInTable.Count());
        }
        public void Insert_Table_Entity()
        {
            CleanupTable("test1");

            IAzureTable<TestTableEntity> testTable = new AzureTable<TestTableEntity>(CloudStorageAccount.DevelopmentStorageAccount, "test1");
            

            var entity = new TestTableEntity
            {
                PartitionKey = "partitionkey",
                RowKey = Guid.NewGuid().ToString(),
                Name = "testname",
                Price = 10
            };

            testTable.Insert(entity);

            var retrievedEntities = testTable.Query.Where(x => x.PartitionKey == "partitionkey").ToList();
            Assert.AreEqual(1, retrievedEntities.Count());
        }
Пример #39
0
        public override void Run()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher(
              (name, publisher) =>
              {
                  var connectionString = RoleEnvironment.GetConfigurationSettingValue(name);
                  publisher(connectionString);
              }
            );

            var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            AzureQueue<NewCustomerCommand> queue = new AzureQueue<NewCustomerCommand>(account);
            queue.EnsureExist();

            while (true)
            {
            try
            {
                var message = queue.GetMessage();
                if (message != null)
                {
                    AzureTable<Customer> table = new AzureTable<Customer>(account);
                    var guiid= Guid.NewGuid().ToString();
                    table.AddEntity( new Customer
                    {
                        Id = Guid.NewGuid().ToString(),
                        PartitionKey = guiid,
                        RowKey = message.FirstName,
                        FirstName = message.FirstName,
                        LastName=message.LastName,
                        Address=message.Address,
                        Phone=message.Phone,
                        Email=message.Email
                    });
                    queue.DeleteMessage(message);
                }
            }
            catch { }
            Thread.Sleep(5000);
            }
        }
Пример #40
0
 public void CreateNewInstance()
 {
     var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
     var azureTable = new AzureTable<TestRow>(account);
     Assert.IsInstanceOfType(azureTable, typeof(AzureTable<TestRow>));
 }
        public void InsertOrMerge_Table_Entity()
        {
            CleanupTable("test4");

            IAzureTable<TestTableEntity> testTable = new AzureTable<TestTableEntity>(CloudStorageAccount.DevelopmentStorageAccount, "test4");
            


            var rowKey = Guid.NewGuid().ToString();

            var entity = new TestTableEntity
            {
                PartitionKey = "partitionkey",
                RowKey = rowKey,
                Name = "testname",
                Price = 10
            };

            testTable.Insert(entity);

            var retrievedEntities = testTable.Query.Where(x => x.PartitionKey == "partitionkey").ToList();

            Assert.AreEqual(1, retrievedEntities.Count());
            var retrievedEntity = retrievedEntities.First();
            Assert.AreEqual("partitionkey", retrievedEntity.PartitionKey);
            Assert.AreEqual(rowKey, retrievedEntity.RowKey);
            Assert.AreEqual("testname", retrievedEntity.Name);
            Assert.AreEqual(10, retrievedEntity.Price);


            var entity2 = new TestTableEntity
            {
                PartitionKey = "partitionkey",
                RowKey = rowKey,
                Name = "testname2",
                Price = 100
            };

            testTable.InsertOrMerge(entity2);

            var retrievedEntities2 = testTable.Query.Where(x => x.PartitionKey == "partitionkey").ToList();

            Assert.AreEqual(1, retrievedEntities2.Count());
            var retrievedEntity2 = retrievedEntities2.First();
            Assert.AreEqual("partitionkey", retrievedEntity2.PartitionKey);
            Assert.AreEqual(rowKey, retrievedEntity2.RowKey);
            Assert.AreEqual("testname2", retrievedEntity2.Name);
            Assert.AreEqual(100, retrievedEntity2.Price);

        }
Пример #42
0
        public void SaveManyAndDeleteMany()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable<TestRow>(account, TableName);
            var row1 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany" };
            var row2 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany" };

            azureTable.Delete(new[] { row1, row2 });
            var rowsToDelete = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                                select o).ToList();
            Assert.AreEqual(0, rowsToDelete.Count);

            azureTable.Add(new[] { row1, row2 });
            var insertedRows = (from o in azureTable.Query
                                where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                                select o).ToList();
            Assert.AreEqual(2, insertedRows.Count);

            azureTable.Delete(new[] { row1, row2 });
            var actualRows = (from o in azureTable.Query
                              where o.PartitionKey == "partition_key_SaveManyAndDeleteMany"
                              select o).ToList();
            Assert.AreEqual(0, actualRows.Count);
        }
Пример #43
0
        public void DeleteAndAddAndGet()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
            var azureTable = new AzureTable<TestRow>(account, TableName);
            var row = new TestRow
            {
                PartitionKey = "partition_key_DeleteAndAddAndGet",
                RowKey = "row_key_DeleteAndAddAndGet",
                Content = "content"
            };

            azureTable.Delete(row);
            TestRow deletedRow = (from o in azureTable.Query
                                  where o.RowKey == row.RowKey
                                  select o).SingleOrDefault();
            Assert.IsNull(deletedRow);

            azureTable.Add(row);
            TestRow savedRow = (from o in azureTable.Query
                                where o.RowKey == row.RowKey &&
                                      o.PartitionKey == "partition_key_DeleteAndAddAndGet" &&
                                              o.Content == "content"
                                select o).SingleOrDefault();
            Assert.IsNotNull(savedRow);

            azureTable.Delete(row);
            TestRow actualRow = (from o in azureTable.Query
                                 where o.RowKey == row.RowKey
                                 select o).SingleOrDefault();
            Assert.IsNull(actualRow);
        }
Пример #44
0
 public StoreRepository()
 {
     var factory = new AzureStorageFactory();
     _zipStore = (AzureTable<ZipStore>)factory.GetTable<ZipStore>(FBwithWA.Domain.AzureConstants.ZipStoreTableName);
     _store = (AzureTable<Store>)factory.GetTable<Store>(FBwithWA.Domain.AzureConstants.StoreTableName);
 }
Пример #45
0
 public static void Initialize(TestContext context)
 {
     var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
     var azureTable = new AzureTable<TestRow>(account, TableName);
     azureTable.EnsureExist();
 }
Пример #46
0
 public ContactRepository()
 {
     var factory = new AzureStorageFactory(CloudStorageAccount.FromConfigurationSetting("DataConnectionString"));
     _table = (AzureTable<Contact>) factory.GetTable<Contact>(FBwithWA.Domain.AzureConstants.ContactTableName);
 }
Пример #47
0
        /// <summary>
        /// Creates a data source that can be used client-side.
        /// </summary>
        public ClientDataSource()
        {
            var connectionString = Settings.Default.DataConnectionString;
            var storageAccount = CloudStorageAccount.Parse(connectionString);

            var blobEndpointUri = storageAccount.BlobEndpoint.AbsoluteUri;
            var tableEndpointUri = storageAccount.TableEndpoint.AbsoluteUri;
            var credentials = storageAccount.Credentials;

            var filesContainerName = Settings.Default.FilesContainerName;
            _files = AzureContainer.Connect(filesContainerName, blobEndpointUri, credentials);

            var outputsContainerName = Settings.Default.OutputsContainerName;
            _outputs = AzureContainer.Connect(outputsContainerName, blobEndpointUri, credentials);

            var procDllsContainerName = Settings.Default.ProcDllsContainerName;
            _procDlls = AzureContainer.Connect(procDllsContainerName, blobEndpointUri, credentials);

            _entries = AzureTable<Entry>.Connect(tableEndpointUri, credentials);
            _users = AzureTable<User>.Connect(tableEndpointUri, credentials);
        }
        public void Setup()
        {
            this.webSiteTable = new AzureTable<WebSiteRow>(CloudStorageAccount.DevelopmentStorageAccount, "WebSitesTest");
            this.bindingTable = new AzureTable<BindingRow>(CloudStorageAccount.DevelopmentStorageAccount, "BindingsTest");
            this.webSiteTable.CreateIfNotExist();
            this.bindingTable.CreateIfNotExist();
            this.webSiteRepository = new WebSiteRepository(this.webSiteTable, this.bindingTable);

            this.certificateTable = new AzureTable<CertificateRow>(CloudStorageAccount.DevelopmentStorageAccount, "CertificatesTest");
            this.certificateTable.CreateIfNotExist();
            this.certificateBlobContainer = new AzureBlobContainer<byte[]>(CloudStorageAccount.DevelopmentStorageAccount, "CertificatesTest");
            this.certificateBlobContainer.EnsureExist();
            this.certificateRepository = new CertificateRepository(this.certificateTable, this.certificateBlobContainer, this.webSiteRepository);
        }
        public void Bulk_InsertOrMerge_Table_Entities()
        {
            CleanupTable("test5");

            IAzureTable<TestTableEntity> testTable = new AzureTable<TestTableEntity>(CloudStorageAccount.DevelopmentStorageAccount, "test5");
            

            var entities = new List<TestTableEntity>();

            for (var i = 0; i < 150; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            for (var i = 0; i < 30; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey2",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            for (var i = 0; i < 220; i++)
            {
                var entity = new TestTableEntity
                {
                    PartitionKey = "partitionkey3",
                    RowKey = Guid.NewGuid().ToString(),
                    Name = "testname",
                    Price = 10
                };
                entities.Add(entity);
            }
            testTable.Insert(entities);


            var retrievedEntities = testTable.Query.ToList();
            Assert.AreEqual(10, retrievedEntities.Select(x => x.Price).Distinct().Single());
            Assert.AreEqual("testname", retrievedEntities.Select(x => x.Name).Distinct().Single());
            

            var entitiesToMerge = entities.Select(x => new TestTableEntity
            {
                PartitionKey = x.PartitionKey,
                RowKey = x.RowKey,
                Name = "new name",
                Price = 20
            });
            testTable.InsertOrMerge(entitiesToMerge);

            var retrievedEntities2 = testTable.Query.ToList();

            Assert.AreEqual(20, retrievedEntities2.Select(x => x.Price).Distinct().Single());
            Assert.AreEqual("new name", retrievedEntities2.Select(x => x.Name).Distinct().Single());
        }
        private static IEnumerable<WebSiteRow> CreateAndSaveWebSiteRows(AzureTable<WebSiteRow> table, int count)
        {
            var sites = new List<WebSiteRow>();

            for (int k = 0; k < count; k++)
            {
                sites.Add(CreateWebSiteRow());
            }

            table.AddEntity(sites);

            return sites;
        }
 private static WebSiteRow CreateAndSaveWebSiteRow(AzureTable<WebSiteRow> table)
 {
     WebSiteRow site = CreateWebSiteRow();
     table.AddEntity(site);
     return site;
 }
 public void Setup()
 {
     this.webSiteTable = new AzureTable<WebSiteRow>(CloudStorageAccount.DevelopmentStorageAccount, "WebSitesTest");
     this.bindingTable = new AzureTable<BindingRow>(CloudStorageAccount.DevelopmentStorageAccount, "BindingsTest");
     this.webSiteTable.CreateIfNotExist();
     this.bindingTable.CreateIfNotExist();
     this.repository = new WebSiteRepository(this.webSiteTable, this.bindingTable);
 }
 private static CertificateRow CreateAndSaveCertificateRow(AzureTable<CertificateRow> table)
 {
     CertificateRow info = CreateCertificateRow();
     table.AddEntity(info);
     return info;
 }
        private static IEnumerable<CertificateRow> CreateAndSaveCertificateRows(AzureTable<CertificateRow> table, int count)
        {
            List<CertificateRow> infos = new List<CertificateRow>();

            for (int k = 0; k < count; k++)
            {
                infos.Add(CreateCertificateRow());
            }

            table.AddEntity(infos);

            return infos;
        }