Ejemplo n.º 1
0
        public void It_writes_must_understand()
        {
            var header = new MessageHeader(XName.Get("headerName", "headerNamespace"), new XNode[] {}, true);

            var headerElement = XElementExtensions.ParseGeneratedXml(header.Write);

            Assert.AreEqual("true", headerElement.Attribute(Constants.Namespace + "mustUnderstand").Value);
        }
Ejemplo n.º 2
0
        public void It_assumes_must_understand_is_false_if_there_is_no_attribute()
        {
            var headerElement = new XElement("headerName");

            var header = new MessageHeader(headerElement);

            Assert.IsFalse(header.MustUnderstand);
        }
Ejemplo n.º 3
0
        public void It_reads_header_namespace()
        {
            var headerElement = new XElement(XName.Get("headerName","headerNamespace"));

            var header = new MessageHeader(headerElement);

            Assert.AreEqual("headerNamespace", header.Name.Namespace.NamespaceName);
        }
Ejemplo n.º 4
0
        public void It_reads_header_name()
        {
            var headerElement = new XElement("headerName");

            var header = new MessageHeader(headerElement);

            Assert.AreEqual("headerName",header.Name.LocalName);
        }
Ejemplo n.º 5
0
        public void It_writes_header_name_with_namespace()
        {
            var header = new MessageHeader(XName.Get("headerName", "headerNamespace"), new XNode[] { }, true);

            var headerElement = XElementExtensions.ParseGeneratedXml(header.Write);

            Assert.AreEqual("headerName", headerElement.Name.LocalName);
            Assert.AreEqual("headerNamespace", headerElement.Name.NamespaceName);
        }
Ejemplo n.º 6
0
        public void It_reads_must_understand_from_attribute()
        {
            var headerElement = new XElement("headerName",
                new XAttribute(Constants.Namespace + "mustUnderstand", true));

            var header = new MessageHeader(headerElement);

            Assert.IsTrue(header.MustUnderstand);
        }
Ejemplo n.º 7
0
        public void It_writes_header_contents()
        {
            var header = new MessageHeader(XName.Get("headerName", "headerNamespace"),
                                           new XNode[]
                                               {
                                                   new XText("someText"),
                                                   new XElement("someNestedElement")
                                               }, true);

            var headerElement = XElementExtensions.ParseGeneratedXml(header.Write);
            var headerContents = headerElement.Nodes().ToList();
            var textNode = (XText) headerContents[0];
            Assert.AreEqual("someText", textNode.Value);
            var nestedElement = (XElement) headerContents[1];
            Assert.AreEqual("someNestedElement", nestedElement.Name.LocalName);
        }
        public void It_writes_headers()
        {
            var message = new OutgoingMessage();

            var headerName = XName.Get("someHeader","someNamespace");
            var header = new MessageHeader(
                headerName, 
                new XNode[] {new XText("someText")}, 
                false);
            message.AddHeader(header);

            var envelope = XElementExtensions.ParseGeneratedXml(message.Write);

            Assert.AreEqual(SOAP.Constants.Envelope, envelope.Name);
            var headerSectionElement = envelope.Element(SOAP.Constants.Header);
            var headerElement = headerSectionElement.Element(headerName);
            var headerContent = (XText)headerElement.FirstNode;
            Assert.AreEqual("someText", headerContent.Value);
        }
Ejemplo n.º 9
0
        public void AddHeader(IMessageHeader typedHeader, bool mustUnderstand)
        {
            var header = new MessageHeader(typedHeader.Name, typedHeader.Write(), mustUnderstand);

            _headers.Add(header);
        }
Ejemplo n.º 10
0
 public void AddHeader(MessageHeader header)
 {
     _headers.Add(header);
 }