Beispiel #1
0
        public void can_get_raw_xml_document()
        {
            var context = StubHttpContext.Empty();

            var serializer = new XmlSerializer(typeof(MyMessage));

            serializer.Serialize(context.Response.Body, new MyMessage {
                Age = 3, Name = "Declan"
            });

            context.Response.Body.Position = 0;

            var body = new HttpResponseBody(null, context);

            var root = body.ReadAsXml();

            root.DocumentElement["Name"].InnerText.ShouldBe("Declan");
        }
Beispiel #2
0
        public void can_parse_xml()
        {
            var context = StubHttpContext.Empty();

            var serializer = new XmlSerializer(typeof(MyMessage));

            serializer.Serialize(context.Response.Body, new MyMessage {
                Age = 3, Name = "Declan"
            });

            context.Response.Body.Position = 0;

            var body = new HttpResponseBody(null, context);

            var message = body.ReadAsXml <MyMessage>();

            message.Name.ShouldBe("Declan");
        }