Example #1
0
        public void SerializeToXml()
        {
            var isa = new WcfSqlAdapter.Inbound(
                a => {
                a.Address = new SqlAdapterConnectionUri {
                    InboundId = "AvailableBatches", Server = "localhost", InitialCatalog = "BizTalkFactoryTransientStateDb"
                };
                a.InboundOperationType         = InboundOperation.XmlPolling;
                a.PolledDataAvailableStatement = "SELECT COUNT(1) FROM vw_claim_AvailableTokens";
                a.PollingStatement             = "EXEC usp_claim_CheckOut";
                a.PollingInterval                = TimeSpan.FromHours(2);
                a.InboundBodyLocation            = InboundMessageBodySelection.UseBodyPath;
                a.InboundBodyPathExpression      = "/BodyWrapper/*";
                a.InboundNodeEncoding            = MessageBodyFormat.Xml;
                a.XmlStoredProcedureRootNodeName = "BodyWrapper";
                a.ServiceBehaviors               = new[] {
                    new SqlAdapterInboundTransactionBehavior {
                        TransactionIsolationLevel = IsolationLevel.Serializable
                    }
                };
            });
            var xml = ((IAdapterBindingSerializerFactory)isa).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<BindingType vt=\"8\">sqlBinding</BindingType>" +
                    "<BindingConfiguration vt=\"8\">" +
                    "&lt;binding name=\"sqlBinding\" " +
                    "polledDataAvailableStatement=\"SELECT COUNT(1) FROM vw_claim_AvailableTokens\" " +
                    "pollingStatement=\"EXEC usp_claim_CheckOut\" " +
                    "pollingIntervalInSeconds=\"7200\" " +
                    "inboundOperationType=\"XmlPolling\" " +
                    "xmlStoredProcedureRootNodeName=\"BodyWrapper\" /&gt;" +
                    "</BindingConfiguration>" +
                    "<ServiceBehaviorConfiguration vt=\"8\">" +
                    "&lt;behavior name=\"ServiceBehavior\"&gt;" +
                    "&lt;sqlAdapterInboundTransactionBehavior transactionIsolationLevel=\"Serializable\" /&gt;" +
                    "&lt;/behavior&gt;" +
                    "</ServiceBehaviorConfiguration>" +
                    "<EndpointBehaviorConfiguration vt=\"8\">&lt;behavior name=\"EndpointBehavior\" /&gt;" + "</EndpointBehaviorConfiguration>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyPath</InboundBodyLocation>" +
                    "<InboundBodyPathExpression vt=\"8\">/BodyWrapper/*</InboundBodyPathExpression>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                    "<DisableLocationOnFailure vt=\"11\">0</DisableLocationOnFailure>" +
                    "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                    "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                    "<CredentialType vt=\"8\">None</CredentialType>" +
                    "<OrderedProcessing vt=\"11\">0</OrderedProcessing>" +
                    "</CustomProps>"));
        }
Example #2
0
        public void ValidateDoesNotThrow()
        {
            var isa = new WcfSqlAdapter.Inbound(
                a => {
                a.Address = new SqlAdapterConnectionUri {
                    InboundId = "AvailableBatches", Server = "localhost", InitialCatalog = "BizTalkFactoryTransientStateDb"
                };
                a.InboundOperationType         = InboundOperation.XmlPolling;
                a.PolledDataAvailableStatement = "SELECT COUNT(1) FROM vw_claim_AvailableTokens";
                a.PollingStatement             = "EXEC usp_claim_CheckOut";
                a.PollingInterval                = TimeSpan.FromHours(2);
                a.InboundBodyLocation            = InboundMessageBodySelection.UseBodyPath;
                a.InboundBodyPathExpression      = "/BodyWrapper/*";
                a.InboundNodeEncoding            = MessageBodyFormat.Xml;
                a.XmlStoredProcedureRootNodeName = "BodyWrapper";
                a.ServiceBehaviors               = new[] {
                    new SqlAdapterInboundTransactionBehavior {
                        TransactionIsolationLevel = IsolationLevel.Serializable
                    }
                };
            });

            Assert.That(() => ((ISupportValidation)isa).Validate(), Throws.Nothing);
        }