private static IProjectTree ChangePropertyValues(IProjectTreePropertiesProvider propertiesProvider, IProjectTree child)
        {
            var propertyContextAndValues = new ProjectTreeCustomizablePropertyContextAndValues(child);

            propertiesProvider.CalculatePropertyValues(propertyContextAndValues, propertyContextAndValues);

            return(propertyContextAndValues.Tree);
        }
        private static IProjectTree ChangePropertyValues(IProjectTreePropertiesProvider propertiesProvider, IProjectTree child, IImmutableDictionary <string, string> projectTreeSettings)
        {
            var propertyContextAndValues = new ProjectTreeCustomizablePropertyContextAndValues(child, projectTreeSettings);

            propertiesProvider.CalculatePropertyValues(propertyContextAndValues, propertyContextAndValues);

            return(propertyContextAndValues.Tree);
        }
        /// <summary>
        ///     Visits the entire tree, calling <see cref="IProjectTreePropertiesProvider.CalculatePropertyValues(IProjectTreeCustomizablePropertyContext, IProjectTreeCustomizablePropertyValues)"/>
        ///     for every node.
        /// </summary>
        public static IProjectTree ChangePropertyValuesForEntireTree(this IProjectTreePropertiesProvider propertiesProvider, IProjectTree tree)
        {
            // Cheat here, because the IProjectTree that we get from ProjectTreeParser is mutable, we want to clone it
            // so that any properties providers changes don't affect the "original" tree. If we implemented a completely
            // immutable tree, then we wouldn't have to do that - but that's currently a lot of work for test-only purposes.
            string treeAsString = ProjectTreeWriter.WriteToString(tree);

            return(ChangePropertyValuesWalkingTree(propertiesProvider, ProjectTreeParser.Parse(treeAsString)));
        }
        private static IProjectTree ChangePropertyValuesWalkingTree(IProjectTreePropertiesProvider propertiesProvider, IProjectTree tree)
        {
            tree = ChangePropertyValues(propertiesProvider, tree);

            foreach (IProjectTree child in tree.Children)
            {
                tree = ChangePropertyValuesWalkingTree(propertiesProvider, child).Parent;
            }

            return(tree);
        }
        private static IProjectTree ChangePropertyValuesWalkingTree(IProjectTreePropertiesProvider propertiesProvider, IProjectTree tree, IImmutableDictionary <string, string> projectTreeSettings)
        {
            tree = ChangePropertyValues(propertiesProvider, tree, projectTreeSettings);

            foreach (IProjectTree child in tree.Children)
            {
                tree = ChangePropertyValuesWalkingTree(propertiesProvider, child, projectTreeSettings).Parent;
            }

            return(tree);
        }