public void AddProperties_CosmosDbSystemProperty_Renames() { // ARRANGE var properties = new Dictionary <string, object> { { "id", "some id" }, { "anotherProperty", "some value" } }; // ACT var result = new Dictionary <string, object>(); Migrator.AddProperties(properties, (n, v) => result.Add(n, v)); // ASSERT CollectionAssert.DoesNotContain(result.Keys, "id"); CollectionAssert.Contains(result.Keys, "prop_id"); CollectionAssert.Contains(result.Keys, "anotherProperty"); }
public void AddProperties_Enumerable_Serializes() { // ARRANGE var properties = new Dictionary <string, object> { { "regularProperty", "some value" }, { "arrayProperty", new [] { "value 1", "value 2" } } }; // ACT var result = new Dictionary <string, object>(); Migrator.AddProperties(properties, (n, v) => result.Add(n, v)); // ASSERT Assert.AreEqual("some value", result["regularProperty"]); var arrayPropertyValue = result["arrayProperty"]; Assert.IsNotInstanceOfType(arrayPropertyValue, typeof(IEnumerable <object>)); Assert.IsTrue(arrayPropertyValue.ToString().StartsWith("[")); Assert.IsTrue(arrayPropertyValue.ToString().EndsWith("]")); }