Пример #1
0
        public void ExecutePromotesOrWritesLocalNameValueInContext()
        {
            var messageContextMock = new MessageContextMock();
            var newValue           = string.Empty;

            var sut = new QNameValueExtractor(BizTalkFactoryProperties.OutboundTransportLocation.QName, "/letter/*/to", ExtractionMode.Promote, QNameValueExtractionMode.LocalName);

            sut.Execute(messageContextMock.Object, "ns:value", ref newValue);

            messageContextMock.Verify(c => c.Promote(BizTalkFactoryProperties.OutboundTransportLocation, "value"));
            newValue.Should().BeEmpty();
        }
Пример #2
0
        public void ExecuteDemotesLocalNameValueInContextAndKeepOriginalPrefix()
        {
            var messageContextMock = new MessageContextMock();

            messageContextMock.Setup(c => c.GetProperty(BizTalkFactoryProperties.OutboundTransportLocation)).Returns("new-value");
            var newValue = string.Empty;

            var sut = new QNameValueExtractor(BizTalkFactoryProperties.OutboundTransportLocation.QName, "/letter/*/to", ExtractionMode.Demote, QNameValueExtractionMode.LocalName);

            sut.Execute(messageContextMock.Object, "ns:value", ref newValue);

            messageContextMock.Verify(c => c.Promote(BizTalkFactoryProperties.OutboundTransportLocation, It.IsAny <string>()), Times.Never);
            newValue.Should().Be("ns:new-value");
        }