public void AddDependency_PrivatePropertiesInDependencyPath_Supported() { var random = new Random(); var expectedPrice = random.Next(1, 100); var expectedQuantity = random.Next(100, 200); var expectedCost = expectedPrice * expectedQuantity; var mapItems = PathBuildingTestClassWithPrivatePropertiesAndFields.PropertiesDependenciesMap.MapItems; Assert.Equal(2, mapItems.Count); var pricePropertyPathItemWithRoot = mapItems.Single(mi => mi.PathStrings.Skip(1).Single() == "_priceProperty"); var quantityPropertyPathItemWithRoot = mapItems.Single(mi => mi.PathStrings.Skip(1).Single() == "_quantityProperty"); var pricePropertyPathItem = pricePropertyPathItemWithRoot.Ancestor; var quantityPropertyPathItem = quantityPropertyPathItemWithRoot.Ancestor; Assert.Equal("root", pricePropertyPathItemWithRoot.PathStrings.First()); Assert.Equal("root", quantityPropertyPathItemWithRoot.PathStrings.First()); //Test compiled getters var obj = PathBuildingTestClassWithPrivatePropertiesAndFields.CreateWithPrivateProperties(expectedPrice, expectedQuantity); var actualPrice = (int)((PropertyPathItem <PathBuildingTestClassWithPrivatePropertiesAndFields>)pricePropertyPathItem).PropertyOrFieldGetter(obj); var actualQuantity = (int)((PropertyPathItem <PathBuildingTestClassWithPrivatePropertiesAndFields>)quantityPropertyPathItem).PropertyOrFieldGetter(obj); Assert.Equal(expectedPrice, actualPrice); Assert.Equal(expectedQuantity, actualQuantity); //Test compiled setter Assert.Equal(0, obj.GetCostProperty()); pricePropertyPathItem.UpdateDependentPropertyOrFieldAction(obj); Assert.Equal(expectedCost, obj.GetCostProperty()); obj = PathBuildingTestClassWithPrivatePropertiesAndFields.CreateWithPrivateProperties(expectedPrice, expectedQuantity); Assert.Equal(0, obj.GetCostProperty()); quantityPropertyPathItem.UpdateDependentPropertyOrFieldAction(obj); Assert.Equal(expectedCost, obj.GetCostProperty()); }