public void TestWithMultipleConverters() { string trueValue = "Yes"; StringMapTranslation stringMapConverter = new StringMapTranslation(new Dictionary <string, string> { ["Yes"] = "Y" }); StringToBool toBoolConverter = new StringToBool("Y"); FieldMap map = new FieldMap("source", "dest", stringMapConverter, toBoolConverter); Assert.AreEqual(true, ImportMap.ConvertValue(trueValue, map, new BooleanAttributeMetadata(), service)); }
public void Test() { XrmFakedContext context = new XrmFakedContext(); IOrganizationService service = context.GetOrganizationService(); string original = "Original"; string converted = "New"; StringMapTranslation converter = new StringMapTranslation(new Dictionary<string, string> { [original] = converted }); Assert.AreEqual(converted, converter.Convert(original, service)); Assert.AreEqual(null, converter.Convert("UNKNOWN", service)); }