Example #1
0
        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}/disconnects/1/notes", Helper.AccountId),
                    EstimatedContent = Helper.ToXmlString(item),
                    HeadersToSend = new Dictionary <string, string> {
                        { "Location", string.Format("/v1.0/accounts/{0}/portins/1/disconnects/11299", Helper.AccountId) }
                    }
                },
                new RequestHandler
                {
                    EstimatedMethod = "GET",
                    EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/disconnects/1/notes", Helper.AccountId),
                    ContentToSend = new StringContent(TestXmlStrings.NotesResponse, Encoding.UTF8, "application/xml")
                }
            }))
            {
                var client     = Helper.CreateClient();
                var disconnect = new Disconnect();
                disconnect.SetClient(client);
                var r = disconnect.AddNote("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);
            }
        }