private void PopulateJournal() { var journal = new ActivityTrackerFactory <DynamicTableEntity>().Create(_JournalTableName, (string)null); var numberOfCycles = 1; for (int i = 0; i < numberOfCycles; i++) { foreach (var typeId in _SubjectTypeIds) { var tId = new KeyValuePair <string, string>("typeId", typeId); foreach (var subjectId in _SubjectIds) { var sId = new KeyValuePair <string, string>("subjectId", subjectId); var partitionKey = $"{subjectId}-{typeId}"; var rowKey = DateTime.UtcNow.Ticks.ToString(); var value = new KeyValuePair <string, string>("value", RandomSelect(new string[] { "1", "2", "3" })); var actor = new KeyValuePair <string, string>("actor", RandomSelect(_Actors)); var valueType = new KeyValuePair <string, string>("valueType", RandomSelect(_ValueTypes)); DynamicTableEntity dynamicTableEntity = new DynamicTableEntity(partitionKey, rowKey); dynamicTableEntity.Properties = CloudTableUtil.Convert(new KeyValuePair <string, string>[] { value, actor, valueType, sId, tId }); journal.Insert(dynamicTableEntity); } } } }
public static void TestClassInitialize(TestContext testContext) { Test.Info(string.Format("{0} Class Initialize", testContext.FullyQualifiedTestClassName)); Test.FullClassName = testContext.FullyQualifiedTestClassName; StorageAccount = GetCloudStorageAccountFromConfig(); //init the blob helper for blob related operations blobUtil = new CloudBlobUtil(StorageAccount); queueUtil = new CloudQueueUtil(StorageAccount); tableUtil = new CloudTableUtil(StorageAccount); // import module string moduleFilePath = Test.Data.Get("ModuleFilePath"); PowerShellAgent.ImportModule(moduleFilePath); //set the default storage context PowerShellAgent.SetStorageContext(StorageAccount.ToString(true)); random = new Random(); ContainerInitCount = blobUtil.GetExistingContainerCount(); QueueInitCount = queueUtil.GetExistingQueueCount(); TableInitCount = tableUtil.GetExistingTableCount(); }
public static void TestClassInitialize(TestContext testContext) { Test.Info(string.Format("{0} Class Initialize", testContext.FullyQualifiedTestClassName)); Test.FullClassName = testContext.FullyQualifiedTestClassName; //add the common initialization if (StorageAccount == null) { StorageAccount = GetCloudStorageAccountFromConfig(useHttps: useHttps); Test.Info("Got storage account from config: {0}", StorageAccount.ToString(true)); } //init the blob helper for blob related operations blobUtil = new CloudBlobUtil(StorageAccount); queueUtil = new CloudQueueUtil(StorageAccount); tableUtil = new CloudTableUtil(StorageAccount); fileUtil = new CloudFileUtil(StorageAccount); random = new Random(); SetCLIEnv(testContext); if (null == CommandAgent) { CommandAgent = AgentFactory.CreateAgent(testContext.Properties); } }