示例#1
0
 public static async Task <Lidb> Create(Client client, Lidb item)
 {
     using (var response = await client.MakePostRequest(client.ConcatAccountPath(LidbPath), item))
     {
         return(await Get(client, client.GetIdFromLocationHeader(response.Headers.Location)));
     }
 }
示例#2
0
 public static async Task<Lidb> Create(Client client, Lidb item)
 {
     using (var response = await client.MakePostRequest(client.ConcatAccountPath(LidbPath), item))
     {
         return await Get(client, client.GetIdFromLocationHeader(response.Headers.Location));
     }
 }
示例#3
0
 public static Task <Lidb> Create(Lidb item)
 {
     return(Create(Client.GetInstance(), item));
 }
示例#4
0
 public static Task<Lidb> Create(Lidb item)
 {
     return Create(Client.GetInstance(), item);
 }
        public void CreateTest()
        {
            var item = new Lidb
            {
                CustomerOrderId = "A Test order",
                LidbTnGroups = new[] { 
                    new LidbTnGroup{
                        TelephoneNumbers = new []{"8048030097", "8045030098"},
                        SubscriberInformation = "Joes Grarage",
                        UseType = "RESIDENTIAL",
                        Visibility = "PUBLIC"
                    }
                } 
            };

            using (var server = new HttpServer(new[]
            {
                new RequestHandler
                {
                    EstimatedMethod = "POST",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/lidbs", Helper.AccountId),
                    EstimatedContent = Helper.ToXmlString(item),
                    HeadersToSend =
                        new Dictionary<string, string>
                        {
                            {"Location", string.Format("/v1.0/accounts/{0}/lidbs/1", Helper.AccountId)}
                        }
                },
                new RequestHandler
                {
                    EstimatedMethod = "GET",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/lidbs/1", Helper.AccountId),
                    ContentToSend = new StringContent(TestXmlStrings.Lidb, Encoding.UTF8, "application/xml")
                }
            }))
            {
                var client = Helper.CreateClient();
                var i = Lidb.Create(client, item).Result;
                if (server.Error != null) throw server.Error;
                Assert.AreEqual("255bda29-fc57-44e8-a6c2-59b45388c6d0", i.Id);
            }

        }