Exemple #1
0
 public void CheckMessageBodyXmlWithAttributes3()
 {
     var request = new RestRequest("/test?test1={test1}", HttpMethod.Get) { ContentType = ContentTypes.Xml };
     var pn = new PhoneNumber("1", "514-9700");
     pn.Calls.Add(new PhoneCall{ID = "1", Number = "864-5789"});
     request.AddParameter(pn);
     var body = request.GetRequestBody();
     Assert.IsNotNull(body);
     Assert.AreEqual("<PhoneNumber ID=\"1\">\r\n  <Calls />\r\n  <Number>514-9700</Number>\r\n</PhoneNumber>", body);
 }
Exemple #2
0
        public void CheckMessageBodyXmlWithAttributes2()
        {
						var expected = @"
							<PhoneNumber ID=""1"">
								 <Call ID=""1"">
										<Number>864-5789</Number>
										<Time>0001-01-01T00:00:00</Time>
								 </Call>
								 <Calls />
								 <Number>514-9700</Number>
							</PhoneNumber>
						";
            var request = new RestRequest("/test?test1={test1}", HttpMethod.Get) { ContentType = ContentTypes.Xml };
            var pn = new PhoneNumber("1", "514-9700") { Call = new PhoneCall
            {
                ID = "1", Number = "864-5789"
            }};
            request.AddParameter(pn);
            var body = request.GetRequestBody();
            Assert.IsNotNull(body);
            Assert.AreEqual(expected.AsXmlSanitized(), body.AsXmlSanitized());
        }