コード例 #1
0
        public async System.Threading.Tasks.Task ShouldReturnNewContactAsync()
        {
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);

            var allOrganizations = await tsClient.Customers.Request().GetAsync();

            var defaultOrganization = allOrganizations.First();

            var newContact = new Contact()
            {
                AdditionalData = new System.Collections.Generic.Dictionary <string, object>()
                {
                    { "PPR", "123456700" },
                    { "Division", "CORP" },
                    { "Department", "Technology" },
                    { "Station", "ATL" }
                },
                Email          = "*****@*****.**",
                FirstName      = "Johnny",
                LastName       = "Appleseed",
                IsPortalUser   = true,
                Organization   = "Sandbox",
                OrganizationId = defaultOrganization.OrganizationID,
                Title          = "API Generated User"
            };

            var result = await tsClient.Contacts.Request().AddAsync(newContact);

            Assert.NotNull(result);
        }
コード例 #2
0
        public async void GetAllContactsAsync_Success()
        {
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);
            var contacts = await tsClient.Contacts.Request().GetAsync();

            Assert.NotEmpty(contacts);
        }
コード例 #3
0
        public async void GetContactAsync_Success()
        {
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);
            var contacts = await tsClient.Contacts.Request().GetAsync();

            var contactId = contacts.First().Id;
            var result    = await tsClient.Contacts[contactId].Request().GetAsync();

            Assert.Equal(contactId, result.Id);
        }
コード例 #4
0
        public async void DeleteContactAsync_Success()
        {
            // Setup
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient   = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);
            var newContact = new Models.Contact()
            {
                Email          = "*****@*****.**",
                FirstName      = "Johnny",
                LastName       = "Appleseed",
                IsPortalUser   = true,
                Title          = "API Generated User",
                OrganizationId = GetOrganizationId()
            };
            var contact = await tsClient.Contacts.Request().AddAsync(newContact);

            // Execute
            await tsClient.Contacts[contact.Id].Request().DeleteAsync();
        }
コード例 #5
0
        public async void CreateCustomerAsync_Success()
        {
            // Setup
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient    = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);
            var newCustomer = new Customer()
            {
                Name        = "TEST_API_GEN",
                Description = "This customer was generated by TSServiceClient Unit Test. This should not be used and is okay to be deleted.",
                IsActive    = true
            };

            // Execute
            var result = await tsClient.Customers.Request().AddAsync(newCustomer);

            // Assert
            Assert.IsType <Models.Customer>(result);
            Assert.NotNull(result.Id);
            Assert.Equal(newCustomer.Name, result.Name);
        }
コード例 #6
0
        public async void CreateContactAsync_Success()
        {
            // Setup
            var defaultAuthenticationProvider = new Providers.DefaultAuthenticationProvider(GetOrganizationId(), GetApiToken());
            var tsClient   = new TeamSupportServiceClient(SERVER_NAME, defaultAuthenticationProvider);
            var newContact = new Models.Contact()
            {
                Email          = "*****@*****.**",
                FirstName      = "Johnny",
                LastName       = "Appleseed",
                IsPortalUser   = true,
                Title          = "API Generated User",
                OrganizationId = GetOrganizationId()
            };

            // Execute
            var result = await tsClient.Contacts.Request().AddAsync(newContact);

            // Assert
            Assert.IsType <Models.Contact>(result);
            Assert.NotNull(result.Id);
            Assert.Equal(newContact.Email, result.Email);
        }