public void WhenASOAPEnvelopeWithAHeaderBlockFromAnXContainerIsBuilt()
        {
            var obj = new XmlObjectWithRootAttribute
            {
                MyProperty = 2
            };

            this.soapEnvelope = SoapBuilder.CreateSoap12Envelope()
                                .WithHeader.AddBlock(XElement.Parse(ObjectXmlSerialiser.SerialiseObject(obj, null, null)))
                                .Build()
                                .ToString();

            this.xmlTester.ArrangeActualXml(this.soapEnvelope);

            const string expectedXml =
                @"<env:Envelope xmlns:env=""http://www.w3.org/2003/05/soap-envelope"">
  <env:Header>
    <XmlObjectWithRootAttribute xmlns=""http://root.attribute"">
        <MyProperty>2</MyProperty>
    </XmlObjectWithRootAttribute>
  </env:Header>
</env:Envelope>";

            this.xmlTester.ArrangeExpectedXml(expectedXml);
        }
        public void WhenASOAPEnvelopeWithAHeaderBlockFromAnObjectWithAnXMLRootAttributeIsBuilt_WithAGivenXMLElementNameAndNamespace()
        {
            var obj = new XmlObjectWithRootAttribute
            {
                MyProperty = 2
            };

            this.soapEnvelope = SoapBuilder.CreateSoap12Envelope()
                                .WithHeader.AddBlock(obj, "NewElementName", "http://new.root.namespace")
                                .Build()
                                .ToString();

            this.xmlTester.ArrangeActualXml(this.soapEnvelope);

            const string expectedXml =
                @"<env:Envelope xmlns:env=""http://www.w3.org/2003/05/soap-envelope"">
  <env:Header>
    <NewElementName xmlns=""http://new.root.namespace"">
        <MyProperty>2</MyProperty>
    </NewElementName>
  </env:Header>
</env:Envelope>";

            this.xmlTester.ArrangeExpectedXml(expectedXml);
        }
Example #3
0
        public void WhenASOAPEnvelopeWithABodyEntryFromAnObjectWithAnXMLRootAttributeIsBuilt_WithAGivenXMLElementNameAndNamespace()
        {
            var obj = new XmlObjectWithRootAttribute
            {
                MyProperty = 2
            };

            this.soapEnvelope = SoapBuilder.CreateSoap11Envelope()
                                .WithBody.AddEntry(obj, "NewElementName", "http://new.root.namespace")
                                .Build()
                                .ToString();

            this.xmlTester.ArrangeActualXml(this.soapEnvelope);

            var expectedXml =
                @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">
  <env:Body>
    <NewElementName xmlns=""http://new.root.namespace"">
        <MyProperty>2</MyProperty>
    </NewElementName>
  </env:Body>
</env:Envelope>";

            this.xmlTester.ArrangeExpectedXml(expectedXml);
        }
        public void WhenASOAPEnvelopeWithABodyEntryFromAnObjectWithAnXMLRootAttributeIsBuilt()
        {
            var obj = new XmlObjectWithRootAttribute
            {
                MyProperty = 2
            };

            this.soapEnvelope = SoapBuilder.CreateSoap12Envelope()
                                .WithBody.AddEntry(obj)
                                .Build()
                                .ToString();

            this.xmlTester.ArrangeActualXml(this.soapEnvelope);

            const string expectedXml =
                @"<env:Envelope xmlns:env=""http://www.w3.org/2003/05/soap-envelope"">
  <env:Body>
    <XmlObjectWithRootAttribute xmlns=""http://root.attribute"">
        <MyProperty>2</MyProperty>
    </XmlObjectWithRootAttribute>
  </env:Body>
</env:Envelope>";

            this.xmlTester.ArrangeExpectedXml(expectedXml);
        }
Example #5
0
        public void WhenASOAPEnvelopeWithAHeaderBlockFromAnXMLStringIsBuilt()
        {
            var obj = new XmlObjectWithRootAttribute
            {
                MyProperty = 2
            };

            this.soapEnvelope = SoapBuilder.CreateSoap11Envelope()
                                .WithHeader.AddBlock(ObjectXmlSerialiser.SerialiseObject(obj, null, null))
                                .Build()
                                .ToString();

            this.xmlTester.ArrangeActualXml(this.soapEnvelope);

            const string expectedXml =
                @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">
  <env:Header>
    <XmlObjectWithRootAttribute xmlns=""http://root.attribute"">
        <MyProperty>2</MyProperty>
    </XmlObjectWithRootAttribute>
  </env:Header>
</env:Envelope>";

            this.xmlTester.ArrangeExpectedXml(expectedXml);
        }