public static async Task <Dlda> Create(Client client, Dlda item)
 {
     using (var response = await client.MakePostRequest(client.ConcatAccountPath(DldaPath), item, false))
     {
         return(await Get(client, client.GetIdFromLocationHeader(response.Headers.Location)));
     }
 }
Example #2
0
 public static async Task<Dlda> Create(Client client, Dlda item)
 {
     using (var response = await client.MakePostRequest(client.ConcatAccountPath(DldaPath), item, false)) 
     {
         return await Get(client, client.GetIdFromLocationHeader(response.Headers.Location));
     }
 }
 public Task Update(Dlda item)
 {
     return(Client.MakePutRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", DldaPath, Id)),
                                  item, true));
 }
 public static Task <Dlda> Create(Dlda item)
 {
     return(Create(Client.GetInstance(), item));
 }
        public void CreateTest()
        {
            var item = new Dlda
            {
                CustomerOrderId = "Your Order Id",
                DldaTnGroups = new[]{
                new DldaTnGroup{
                  TelephoneNumbers  =  new TelephoneNumbers {Numbers =  new[]{"9195551212"}},
                  SubscriberType  =  "RESIDENTIAL",
                  ListingType  =  "LISTED",
                  ListingName  =  new ListingName{
                    FirstName  =  "John",
                    LastName  =  "Smith"
                  },
                  ListAddress  =  true,
                  Address  =  new Address{
                    HouseNumber  =  "123",
                    StreetName  =  "Elm",
                    StreetSuffix  =  "Ave",
                    City  =  "Carpinteria",
                    StateCode  =  "CA",
                    Zip  =  "93013",
                    AddressType  =  "DLDA"
                  }
                }
              }
            };

            
            using (var server = new HttpServer(new[]
            {
                new RequestHandler
                {
                    EstimatedMethod = "POST",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas", Helper.AccountId),
                    EstimatedContent = Helper.ToXmlString(item),
                    HeadersToSend =
                        new Dictionary<string, string>
                        {
                            {"Location", string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId)}
                        }
                },
                new RequestHandler
                {
                    EstimatedMethod = "GET",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId),
                    ContentToSend = new  StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
                }
            }))
            {
                var client = Helper.CreateClient();
                var i = Dlda.Create(client, item).Result;
                if (server.Error != null) throw server.Error;
                Assert.AreEqual("ea9e90c2-77a4-4f82-ac47-e1c5bb1311f4", i.Id);
            }

        }
 public void GetHistoryTest()
 {
     using (var server = new HttpServer(new[]
     {
         new RequestHandler
         {
             EstimatedMethod = "GET",
             EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1/history", Helper.AccountId),
             ContentToSend = new StringContent(TestXmlStrings.OrderHistory, Encoding.UTF8, "application/xml")
         }
     }))
     {
         var client = Helper.CreateClient();
         var i = new Dlda {Id = "1"};
         i.SetClient(client);
         var result = i.GetHistory().Result;
         if (server.Error != null) throw server.Error;
         Assert.IsTrue(result.Length > 0);
     }
 }
 public void UpdateTest()
 {
     var item = new Dlda
     {
     };
     using (var server = new HttpServer(new[]
     {
         new RequestHandler
         {
             EstimatedMethod = "PUT",
             EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId),
             ContentToSend = Helper.CreateXmlContent(item)
         }
     }))
     {
         var client = Helper.CreateClient();
         var i = new Dlda { Id = "1" };
         i.SetClient(client);
         i.Update(item).Wait();
         if (server.Error != null) throw server.Error;
     }
 }
        public void CreateWithDefaultClientTest()
        {
            var item = new Dlda
            {
            };

            using (var server = new HttpServer(new[]
            {
                new RequestHandler
                {
                    EstimatedMethod = "POST",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas", Helper.AccountId),
                    EstimatedContent = Helper.ToXmlString(item),
                    HeadersToSend =
                        new Dictionary<string, string>
                        {
                            {"Location", string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId)}
                        }
                },
                new RequestHandler
                {
                    EstimatedMethod = "GET",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId),
                    ContentToSend = new  StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
                }
            }))
            {
                var i = Dlda.Create(item).Result;
                if (server.Error != null) throw server.Error;
                Assert.AreEqual("ea9e90c2-77a4-4f82-ac47-e1c5bb1311f4", i.Id);
            }
        }
Example #9
0
 public Task Update(Dlda item)
 {
     return Client.MakePutRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", DldaPath, Id)),
         item, true);
 }
Example #10
0
 public static Task<Dlda> Create(Dlda item)
 {
     return Create(Client.GetInstance(), item);
 }