public void InstancePopulatedFromReaderModifiedAfterwards_ButBeforeCreation() { var objectProperties = new ObjectProperties(new Dictionary <string, object>() { { Constants.TypeNameKey, "TestClass" }, { Constants.VersionKey, (long)1 }, { "_basePrivateField", "Hello" }, { "BasePrivateProperty", "Invalid value" }, { "_childPrivateField", "Seeya" }, { "ChildPrivateProperty", 43 }, }); var reader = new ShapeshifterReader(objectProperties); var builder = new InstanceBuilder <TestClass>(reader); builder.SetMember("BasePrivateProperty", 1); var instance = builder.GetInstance(); instance.GetBasePrivateProperty().Should().Be(1); }
public void InstancePopulatedFromReader() { var objectProperties = new ObjectProperties(new Dictionary <string, object>() { { Constants.TypeNameKey, "TestClass" }, { Constants.VersionKey, (long)1 }, { "_basePrivateField", "Hello" }, { "BasePrivateProperty", 42 }, { "_childPrivateField", "Seeya" }, { "ChildPrivateProperty", 43 }, }); var reader = new ShapeshifterReader(objectProperties); var builder = new InstanceBuilder <TestClass>(reader); var instance = builder.GetInstance(); instance.GetBasePrivateField().Should().Be("Hello"); instance.GetBasePrivateProperty().Should().Be(42); instance.GetChildPrivateField().Should().Be("Seeya"); instance.GetChildPrivateProperty().Should().Be(43); }