コード例 #1
0
        public async Task Delete_RemoveAddress_Success()
        {
            ECommerceWebAppClient client = new ECommerceWebAppClient(siteUrl);

            AuthCookieRequest loginRequest = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };
            await client.Authentication.GetCookie(loginRequest);

            var addressRequest = new AddressRequest
            {
                AddressLine1        = "Jhonnatans Road 2",
                AddressLine2        = "",
                City                = "Marlenburgh",
                Country             = "US",
                IsInternational     = false,
                Name                = null,
                Postal              = "48139",
                StateProvinceRegion = "CT"
            };

            var getUserAddressResponse = client.Addresses.Create(addressRequest).Result;

            var    createdAddres         = getUserAddressResponse.Entity as AddressResponse;
            string addressIdentifier     = createdAddres.Identifier.ToString();
            var    deleteAddressResponse = client.Addresses.Remove(addressIdentifier).Result;

            Assert.IsNotNull(deleteAddressResponse);
        }
コード例 #2
0
        public async Task Post_CreateAddress_Success()
        {
            ECommerceWebAppClient client = new ECommerceWebAppClient(siteUrl);

            //Performing a Login to get the cookie into the client
            AuthCookieRequest loginRequest = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };
            var cookie = await client.Authentication.GetCookie(loginRequest);

            var addressRequest = new AddressRequest
            {
                AddressLine1        = "Irish Road",
                AddressLine2        = "",
                City                = "Marlenburgh",
                Country             = "US",
                IsInternational     = false,
                Name                = "My address",
                Postal              = "48139",
                StateProvinceRegion = "CT"
            };
            var createUserAddressResponse = client.Addresses.Create(addressRequest).Result;

            Assert.IsNotNull(createUserAddressResponse, "Response is null");
            Assert.IsNotNull(createUserAddressResponse.Entity, $"{nameof(createUserAddressResponse.Entity)} is null");
        }
コード例 #3
0
        public async Task Get_AuthToken_Success()
        {
            ECommerceWebAppClient client  = new ECommerceWebAppClient(ServiceConstants.AllPointsUrl);
            AuthCookieRequest     request = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };

            var response = await client.Authentication.GetCookie(request);

            Assert.IsNotNull(response);
        }
コード例 #4
0
        public async Task GetDefaultUserAddress_Success()
        {
            ECommerceWebAppClient client = new ECommerceWebAppClient(siteUrl);

            AuthCookieRequest loginRequest = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };

            await client.Authentication.GetCookie(loginRequest);

            var userAddressResponse = await client.Addresses.GetDefaultAddress();

            Assert.IsNotNull(userAddressResponse);
        }
コード例 #5
0
        public async Task Get_AllUserAddresses_Success()
        {
            ECommerceWebAppClient client = new ECommerceWebAppClient(siteUrl);

            //Performing a Login to get the cookie into the client
            AuthCookieRequest loginRequest = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };
            await client.Authentication.GetCookie(loginRequest);

            var getAllUserAddressesResponse = client.Addresses.GetAddresses("User").Result;

            Assert.IsNotNull(getAllUserAddressesResponse);
        }
コード例 #6
0
        public async Task UpdateAddress()
        {
            ECommerceWebAppClient client = new ECommerceWebAppClient(siteUrl);

            AuthCookieRequest loginRequest = new AuthCookieRequest
            {
                LoginEmail    = "*****@*****.**",
                LoginPassword = "******"
            };
            await client.Authentication.GetCookie(loginRequest);

            var createAddressRequest = new AddressRequest
            {
                AddressLine1        = "I will be updated",
                AddressLine2        = "",
                City                = "Marlenburgh",
                Country             = "US",
                IsInternational     = false,
                Name                = "My address name",
                Postal              = "48139",
                StateProvinceRegion = "CT"
            };
            var httpAddressCreateResponse = await client.Addresses.Create(createAddressRequest);

            var createdAddressResponse = httpAddressCreateResponse.Entity as AddressResponse;

            var updateAddressRequest = new AddressRequest
            {
                AddressLine1        = "Edited address",
                AddressLine2        = "",
                City                = "Boulder",
                Country             = "US",
                ExternalIdentifier  = createdAddressResponse.ExternalIdentifier,
                Identifier          = createdAddressResponse.Identifier,
                IsInternational     = false,
                Name                = "My address name",
                PlatformIdentifier  = createAddressRequest.PlatformIdentifier,
                Postal              = "48139",
                StateProvinceRegion = "CO"
            };

            var updateResponse = client.Addresses.Update(updateAddressRequest).Result;
        }