/// <summary> /// The set config. /// </summary> /// <typeparam name="T"> /// The configuration object that needs to have config values set /// </typeparam> /// <returns> /// The configuration object where properties has been set by the stf configuration /// </returns> protected T SetConfig <T>() where T : class, new() { if (StfConfiguration == null) { return(default(T)); } var configObject = new T(); StfConfiguration.LoadUserConfiguration(configObject); return(configObject); }
public void ReflectionTestMethod1() { var tmc1 = new TestMethod1Class { PropPublicString1 = "pupStr1", PropPublicString2 = "pupStr2" }; // Load a configuration in StfConfiguration var stfConfiguration = new StfConfiguration(@"TestData\Reflection\Reflection1.xml"); // Load that (resolved) configuration into the User Object var props = stfConfiguration.LoadUserConfiguration(tmc1); Assert.IsTrue(props.Count > 0, "Props collection is empty"); Assert.AreEqual("config_key1value", tmc1.PropPublicString1); Assert.AreEqual("config_key2value", tmc1.PropPublicString2); }