예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
 /// <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()];
 }
예제 #4
0
 /// <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()]);
 }