public async Task OneTimeSetUp() { TestSetUp.Reset(false); var config = AgentTester.Configuration.GetSection("CosmosDb"); _removeAfterUse = config.GetValue <bool>("RemoveAfterUse"); _cosmosDb = new CosmosDb(new Cosmos.CosmosClient(config.GetValue <string>("EndPoint"), config.GetValue <string>("AuthKey")), config.GetValue <string>("Database"), createDatabaseIfNotExists: true); var rc = await _cosmosDb.ReplaceOrCreateContainerAsync( new Cosmos.ContainerProperties { Id = "Items", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new Cosmos.UniqueKeyPolicy { UniqueKeys = { new Cosmos.UniqueKey { Paths = { "/serialNo"} } } } }, 400); await rc.ImportBatchAsync <RobotTest, Robot>("Data.yaml", "Robot"); var rdc = await _cosmosDb.ReplaceOrCreateContainerAsync( new Cosmos.ContainerProperties { Id = "RefData", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new Cosmos.UniqueKeyPolicy { UniqueKeys = { new Cosmos.UniqueKey { Paths = { "/type","/value/code" } } } } }, 400); await rdc.ImportValueRefDataBatchAsync <RobotTest>(ReferenceData.Current, "RefData.yaml"); }
public void OneTimeSetUp() { TestSetUp.RegisterSetUp(async(count, data) => { var config = AgentTester.Configuration.GetSection("CosmosDb"); _removeAfterUse = config.GetValue <bool>("RemoveAfterUse"); _cosmosDb = new CosmosDb(new Cosmos.CosmosClient(config.GetValue <string>("EndPoint"), config.GetValue <string>("AuthKey")), config.GetValue <string>("Database"), createDatabaseIfNotExists: true); var rc = await _cosmosDb.ReplaceOrCreateContainerAsync( new Cosmos.ContainerProperties { Id = "Person", PartitionKeyPath = "/_partitionKey" }, 400); await rc.ImportBatchAsync <PersonTest, Person>("Person.yaml", "Person"); var rdc = await _cosmosDb.ReplaceOrCreateContainerAsync( new Cosmos.ContainerProperties { Id = "RefData", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new Cosmos.UniqueKeyPolicy { UniqueKeys = { new Cosmos.UniqueKey { Paths = { "/type","/value/code" } } } } }, 400); await rdc.ImportValueRefDataBatchAsync <PersonTest>(ReferenceData.Current, "RefData.yaml"); return(true); }); AgentTester.StartupTestServer <Startup>(environmentVariablesPrefix: "AppName_"); AgentTester.DefaultExpectNoEvents = true; }