public void BuildXmlTranslationSetWithTranslationInContext() { MessageMock.Setup(c => c.GetProperty(BizTalkFactoryProperties.XmlTranslations)) .Returns( XmlTranslationSetConverter.Serialize( new XmlTranslationSet { Override = true, Items = new[] { new XmlNamespaceTranslation("sourceUrn5", "urn05") } })); var sut = new XmlTranslator { Translations = new XmlTranslationSet { Override = false, Items = new[] { new XmlNamespaceTranslation("sourceUrn1", "urn:test1"), new XmlNamespaceTranslation("sourceUrn2", "urn:test2") } } }; sut.BuildXmlTranslationSet(MessageMock.Object).Should().Be( new XmlTranslationSet { Override = true, Items = new[] { new XmlNamespaceTranslation("sourceUrn5", "urn05") } }); }
internal XmlTranslationSet BuildXmlTranslationSet(IBaseMessage message) { var translations = message.GetProperty(BizTalkFactoryProperties.XmlTranslations); if (translations.IsNullOrEmpty()) { return(Translations); } var contextReplacements = XmlTranslationSetConverter.Deserialize(translations); return(contextReplacements.Union(Translations)); }
/// <summary> /// Saves the current component configuration into the property bag /// </summary> /// <param name="propertyBag">Configuration property bag</param> protected override void Save(IPropertyBag propertyBag) { propertyBag.WriteProperty("Encoding", EncodingConverter.Serialize(Encoding)); propertyBag.WriteProperty("Modes", Modes); propertyBag.WriteProperty("Translations", XmlTranslationSetConverter.Serialize(Translations)); }
/// <summary> /// Loads configuration properties for the component /// </summary> /// <param name="propertyBag">Configuration property bag</param> protected override void Load(IPropertyBag propertyBag) { propertyBag.ReadProperty("Encoding", value => Encoding = EncodingConverter.Deserialize(value)); propertyBag.ReadProperty <XmlTranslationModes>("Modes", value => Modes = value); propertyBag.ReadProperty("Translations", value => Translations = XmlTranslationSetConverter.Deserialize(value)); }