Пример #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()]);
 }