public void EmProperty_ToString_GetExpected() { const string key = "TestKey"; var testProp = new TestProperty(key, 1); string expectedValue = $"{key}:{1};"; Assert.AreEqual(1, testProp.Value); Assert.AreEqual(expectedValue, testProp.ToString()); }
public void EmProperty_ToAndFromString_DataPreserved() { const string key = "TestKey"; var orig = new TestProperty(key, 10); var deserialized = new TestProperty(key); string originalSerialized = orig.ToString(); deserialized.FromString(originalSerialized); string serialized = deserialized.ToString(); Assert.AreEqual(orig.Value, deserialized.Value); Assert.AreEqual(originalSerialized, serialized); }
/// <summary> /// Gets a value for a key in the property file /// </summary> /// <param name="propertyName">Key of the property in the config file</param> /// <returns>the value of the key in the property file</returns> public String GetPropertyByName(TestProperty propertyName) { return System.Configuration.ConfigurationManager.AppSettings[propertyName.ToString()]; }
/// <summary> /// Gets a value for a key in the property file /// </summary> /// <param name="propertyName">Key of the property in the config file</param> /// <returns>the value of the key in the property file</returns> public String GetPropertyByName(TestProperty propertyName) { return(System.Configuration.ConfigurationManager.AppSettings[propertyName.ToString()]); }