Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }