public void GetFieldNames_FlatDocument_IgnoreRenamingOfNonexistingField() { var dataItem = new RemappedFieldsDataItem(new DictionaryDataItem(new Dictionary <string, object> { { "source", "Hello World!" }, { "persisted", 42 } }), new Map <string, string> { { "nonexisting", "target" } }); var fieldNames = dataItem.GetFieldNames(); Assert.IsNotNull(fieldNames, TestResources.NullRemappedFieldNames); CollectionAssert.AreEquivalent(new[] { "source", "persisted" }, fieldNames.ToArray(), TestResources.InvalidRemappedFieldNames); Assert.AreEqual("Hello World!", dataItem.GetValue("source"), TestResources.InvalidRemappedFieldValue); Assert.AreEqual(42, dataItem.GetValue("persisted"), TestResources.InvalidRemappedFieldValue); }
public void GetFieldNames_FlatDocument_MultipleFieldsRenamed() { var dataItem = new RemappedFieldsDataItem(new DictionaryDataItem(new Dictionary <string, object> { { "source1", "Hello World!" }, { "source2", 42 } }), new Map <string, string> { { "source1", "target1" }, { "source2", "target2" } }); var fieldNames = dataItem.GetFieldNames(); Assert.IsNotNull(fieldNames, TestResources.NullRemappedFieldNames); CollectionAssert.AreEquivalent(new[] { "target1", "target2" }, fieldNames.ToArray(), TestResources.InvalidRemappedFieldNames); Assert.AreEqual("Hello World!", dataItem.GetValue("target1"), TestResources.InvalidRemappedFieldValue); Assert.AreEqual(42, dataItem.GetValue("target2"), TestResources.InvalidRemappedFieldValue); }