/// <summary> /// Test a user scenario. Create application, multiple get/put changed data, /// </summary> //[Fact] public async void TestUserScenario() { StorageClient storage = new StorageClient(new HttpClient()); int instanceOwnerId = 42; // Create application instance string instanceId = await storage.PostInstances("TEST/sailor", instanceOwnerId); Instance instance = await storage.GetInstances(instanceId, instanceOwnerId); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("dataFor", instanceOwnerId.ToString()); storage.PostDataReadFromFile(instanceId, instanceOwnerId, "test.json", "application/json"); Instance instanceUpdated = await storage.GetInstances(instanceId, instanceOwnerId); string dataId = instanceUpdated.Data.Keys.First(); for (int i = 0; i < 100; i++) { data.Add("field" + i, RandomString(i)); logger.Information(data["field" + i]); /* * storage.PutData(instanceId, dataId, instanceOwnerId, "test.json", "applicatino/json", data); * * var storedData = storage.GetData(instanceId, dataId, instanceOwnerId); */ } }
public async void StoreAForm() { object jsonContent = new { universe = 42, årsjul = 365, text = "Fem flotte åer er bedre en to ærlige øl!", }; // create instance string newId = await storage.PostInstances(testApplicationId, testInstanceOwnerId); Instance instance = await storage.GetInstances(newId, testInstanceOwnerId); string requestUri = $"{versionPrefix}/instances/{newId}/data?formId=boatdata&instanceOwnerId={testInstanceOwnerId}"; // post the file HttpResponseMessage postResponse = await client.PostAsync(requestUri, jsonContent.AsJson()); postResponse.EnsureSuccessStatusCode(); }