public void GetFieldNames_FlatDocument_FieldCannotBeRenamedToExisting() { var dataItem = new RemappedFieldsDataItem(new DictionaryDataItem(new Dictionary <string, object> { { "source", "Hello World!" }, { "persisted", 42 } }), new Map <string, string> { { "source", "persisted" } }); var fieldNames = dataItem.GetFieldNames(); Assert.IsNotNull(fieldNames, TestResources.NullRemappedFieldNames); CollectionAssert.AreEquivalent(new[] { "persisted" }, fieldNames.ToArray(), TestResources.InvalidRemappedFieldNames); Assert.AreEqual("Hello World!", 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); }