Exemple #1
0
        public void ExecutePromotesOrWritesLocalNameValueInContext()
        {
            var messageContextMock = new MessageContextMock();
            var newValue           = string.Empty;

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

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

            messageContextMock.Verify(c => c.Promote(BizTalkFactoryProperties.ReceiverName, "value"));
            Assert.That(newValue, Is.Empty);
        }
Exemple #2
0
        public void ExecuteDemotesLocalNameValueInContextAndKeepOriginalPrefix()
        {
            var messageContextMock = new MessageContextMock();

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

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

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

            messageContextMock.Verify(c => c.Promote(BizTalkFactoryProperties.ReceiverName, It.IsAny <string>()), Times.Never);
            Assert.That(newValue, Is.EqualTo("ns:new-value"));
        }