public async Task TestUpdateUsersBatch() { Boolean isUpdated = false; // Parameters for the API call List <UserModel> body = new List <UserModel>(); Dictionary <string, object> metadata = new Dictionary <string, object> { { "email", "*****@*****.**" }, { "string_field", "value_1" }, { "number_field", 0 }, { "object_field", new Dictionary <string, string> { { "field_a", "value_a" }, { "field_b", "value_b" } } } }; var userModelA = new UserModel() { UserId = "12345", CompanyId = "67890", Metadata = metadata, ModifiedTime = DateTime.UtcNow }; var userModelB = new UserModel() { UserId = "1234", CompanyId = "6789", Metadata = metadata, SessionToken = "XXXXXXXXX", ModifiedTime = DateTime.UtcNow }; body.Add(userModelA); body.Add(userModelB); // Perform API call try { controller = ControllerTestBase.GetClient().Api; await controller.UpdateUsersBatchAsync(body); isUpdated = true; } catch (APIException) { }; // Test response code Assert.Equal(true, isUpdated); }
public async Task TestGetAppConfig() { Http.Response.HttpStringResponse rsp; // Perform API call try { controller = ControllerTestBase.GetClient().Api; rsp = await controller.GetAppConfigAsync(); } catch (APIException) { rsp = null; }; // Test response code Assert.NotEqual(null, rsp); }
public async Task TestAddEvent() { EventModel eventModel = CreateEvent(); Dictionary <string, string> rsp; // Perform API call try { controller = ControllerTestBase.GetClient().Api; rsp = await controller.CreateEventAsync(eventModel); } catch (APIException) { rsp = null; }; // Test response code Assert.NotEqual(null, rsp); }
public async Task TestUpdateUser() { Boolean isUpdated = false; Dictionary <string, object> metadata = new Dictionary <string, object> { { "email", "*****@*****.**" }, { "string_field", "value_1" }, { "number_field", 0 }, { "object_field", new Dictionary <string, string> { { "field_a", "value_a" }, { "field_b", "value_b" } } } }; var campaign = new CampaignModel() { UtmSource = "Newsletter", UtmMedium = "Email" }; var userModel = new UserModel() { UserAgentString = "Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)", UserId = "12345", CompanyId = "67890", Metadata = metadata, ModifiedTime = DateTime.UtcNow, Campaign = campaign }; // Perform API call try { controller = ControllerTestBase.GetClient().Api; await controller.UpdateUserAsync(userModel); isUpdated = true; } catch (APIException) { }; // Test response code Assert.Equal(true, isUpdated); }
public async Task TestUpdateCompany() { Boolean isUpdated = false; Dictionary <string, object> metadata = new Dictionary <string, object> { { "email", "*****@*****.**" }, { "string_field", "value_1" }, { "number_field", 0 }, { "object_field", new Dictionary <string, string> { { "field_a", "value_a" }, { "field_b", "value_b" } } } }; var campaign = new CampaignModel() { UtmSource = "Adwords", UtmMedium = "Twitter" }; var companyModel = new CompanyModel() { CompanyId = "12345", Metadata = metadata, ModifiedTime = DateTime.UtcNow, Campaign = campaign }; // Perform API call try { controller = ControllerTestBase.GetClient().Api; await controller.UpdateCompanyAsync(companyModel); isUpdated = true; } catch (APIException) { }; // Test response code Assert.Equal(true, isUpdated); }
public async Task TestAddBatchedEvents() { // Parameters for the API call List <EventModel> body = new List <EventModel>(); EventModel eventModel = CreateEvent(); body.Add(eventModel); body.Add(eventModel); Dictionary <string, string> rsp; // Perform API call try { controller = ControllerTestBase.GetClient().Api; rsp = await controller.CreateEventsBatchAsync(body); } catch (APIException) { rsp = null; }; // Test response code Assert.NotEqual(null, rsp); }