public void AddNoteTest()
 {
     var item = new Note
     {
         UserId = "customer",
         Description = "Test"
     };
     using (var server = new HttpServer(new[]{
         new RequestHandler
         {
             EstimatedMethod = "POST",
             EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/importToAccounts/1/notes", Helper.AccountId),
             EstimatedContent = Helper.ToXmlString(item),
             HeadersToSend = new Dictionary<string, string> {
                 {"Location", string.Format("/v1.0/accounts/{0}/portins/1/importToAccounts/11299", Helper.AccountId)} 
             }
         },
         new RequestHandler
         {
             EstimatedMethod = "GET",
             EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/importToAccounts/1/notes", Helper.AccountId),
             ContentToSend = new StringContent(TestXmlStrings.NotesResponse, Encoding.UTF8, "application/xml")
         }
     }))
     {
         var client = Helper.CreateClient();
         var r = ImportToAccount.AddNote(client, "1", item).Result;
         if (server.Error != null) throw server.Error;
         Assert.AreEqual("11299", r.Id);
         Assert.AreEqual("customer", r.UserId);
         Assert.AreEqual("Test", r.Description);
     }
 }
 public static async Task<Note> AddNote(Client client, string orderId, Note note)
 {
     using (var response = await client.MakePostRequest(client.ConcatAccountPath(string.Format("{0}/{1}/notes", PortOutPath, orderId)), note))
     {
         var list = await GetNotes(client, orderId);
         var id = client.GetIdFromLocationHeader(response.Headers.Location);
         return list.First(n => n.Id == id);
     }
 }
Beispiel #3
0
 public async Task<Note> AddNote(Note note)
 {
     using (var response = await Client.MakePostRequest(Client.ConcatAccountPath(string.Format("{0}/{1}/notes", OrderPath, Id)), note))
     {
         var list = await GetNotes();
         var id = Client.GetIdFromLocationHeader(response.Headers.Location);
         return list.First(n => n.Id == id);
     }
 }
 public async Task<Note> AddNote(string orderId, Note note)
 {
     if (orderId == null) throw new ArgumentNullException("orderId");
     using (var response = await Client.MakePostRequest(Client.ConcatAccountPath(string.Format("{0}/{1}/notes", DisconnectNumbersPath, orderId)), note))
     {
         var list = await GetNotes(orderId);
         var id = Client.GetIdFromLocationHeader(response.Headers.Location);
         return list.First(n => n.Id == id);
     }
 }
 public static Task<Note> AddNote(string orderId, Note note)
 {
     return AddNote(Client.GetInstance(), orderId, note);
 }