fix name as requested

This commit is contained in:
adam 2024-10-30 17:43:40 -04:00
parent 675bb9824f
commit dad0f9b376
2 changed files with 14 additions and 14 deletions

View File

@ -24,7 +24,7 @@ namespace greyn.Deployment
*/
var actualConfig = JsonConvert.DeserializeObject<ExpandoObject>(File.ReadAllText(confpath)) ?? new ExpandoObject();
var toReturn = new T();
populateExpando(toReturn, ref actualConfig);
PopulateExpando(toReturn, ref actualConfig);
File.WriteAllText(confpath, JsonConvert.SerializeObject(actualConfig, Formatting.Indented));
readFromExpando(ref toReturn, actualConfig);
@ -40,7 +40,7 @@ namespace greyn.Deployment
}
//TODO: make private but get tests to cooperate... I think that's a c# limitation
internal static void populateExpando<T>(T config, ref ExpandoObject fromFile)
internal static void PopulateExpando<T>(T config, ref ExpandoObject fromFile)
{
if (config == null) return;
if (fromFile == null)
@ -70,14 +70,14 @@ namespace greyn.Deployment
var asField = (FieldInfo)memberInfo;
if (dictionaryFromExpandoFromFile[asField.Name] is ExpandoObject childMemberField)
{
populateExpando(asField.GetValue(config), ref childMemberField);
PopulateExpando(asField.GetValue(config), ref childMemberField);
}
break;
case MemberTypes.Property:
var asProperty = (PropertyInfo)memberInfo;
if (dictionaryFromExpandoFromFile[asProperty.Name] is ExpandoObject childMemberProperty)
{
populateExpando(asProperty.GetValue(config), ref childMemberProperty);
PopulateExpando(asProperty.GetValue(config), ref childMemberProperty);
}
break;
default:

View File

@ -108,7 +108,7 @@ public class ConfigTests
{
var toReturn = new AConfigurationType();
var actualConfig = parse(PerfectConfiguration);
greyn.Deployment.ConfigurationBootstrapper.populateExpando(toReturn, ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(toReturn, ref actualConfig);
Assert.Pass();
}
#endregion
@ -139,7 +139,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
Console.WriteLine("survived populate expando");
var casted = (IDictionary<string, object?>)actualConfig;
Console.WriteLine(casted["aValueTypeButNotAField"]);
@ -172,7 +172,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
Console.WriteLine(casted["aField"]);
Assert.Pass();
@ -194,7 +194,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
Console.WriteLine(casted["subtyped"]);
Assert.Pass();
@ -225,7 +225,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
var subtypeCasted = (IDictionary<string, object?>)casted["subtyped"];
Console.WriteLine(subtypeCasted["aValueType"]);
@ -257,7 +257,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
var subtypeCasted = (IDictionary<string, object?>)casted["subtyped"];
Console.WriteLine(subtypeCasted["aValueTypeButNotAField"]);
@ -285,7 +285,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
var subtypeCasted = (IDictionary<string, object?>)casted["subtyped"];
Console.WriteLine(subtypeCasted["anEnumerableType"]);
@ -309,7 +309,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
Assert.IsNull(casted["subtyped"]);
}
@ -341,7 +341,7 @@ public class ConfigTests
]
}
}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
var casted = (IDictionary<string, object?>)actualConfig;
Assert.IsNotNull(casted["hiImHereToo"]);
}
@ -349,7 +349,7 @@ public class ConfigTests
public void populateExpando_populatesblank()
{
var actualConfig = parse("{}");
greyn.Deployment.ConfigurationBootstrapper.populateExpando(new AConfigurationType(), ref actualConfig);
greyn.Deployment.ConfigurationBootstrapper.PopulateExpando(new AConfigurationType(), ref actualConfig);
dynamic casted = actualConfig;
Console.WriteLine(JsonConvert.SerializeObject(casted, Formatting.Indented));