public void EmProperty_FromString_MismatchedKey_Ignored_GetExpected(string goodString, int expectedValue)
        {
            var testProp = new TestIntProperty("TestKey");

            testProp.FromString(goodString, false);

            Assert.AreEqual(expectedValue, testProp.Value);
        }
        public void EmPropertyInt_FromString_GoodString_GetExpected(string goodString, int expectedValue)
        {
            var testProp = new TestIntProperty("TestKey");

            testProp.FromString(goodString);

            Assert.AreEqual(expectedValue, testProp.Value);
        }
        public void EmProperty_ToString_GetExpected()
        {
            const string key           = "TestKey";
            var          testProp      = new TestIntProperty(key, 1);
            string       expectedValue = $"{key}:{1};";

            Assert.AreEqual(1, testProp.Value);
            Assert.AreEqual(expectedValue, testProp.ToString());
        }
        public void EmProperty_FromString_MismatchedKey_Throws(string serialValue, string badKey)
        {
            var         testProp = new TestIntProperty("TestKey");
            EmException emEx     = Assert.Throws <EmException>(() => testProp.FromString(serialValue, true));

            Assert.IsNotNull(emEx.CurrentBuffer);
            Assert.IsFalse(emEx.CurrentBuffer.IsEmpty);
            Assert.AreEqual(badKey, emEx.CurrentBuffer.ToString());
        }
        public void EmProperty_FromString_MismatchedKey_Throws(string serialValue)
        {
            var testProp = new TestIntProperty("TestKey");

            Assert.Throws <AssertionException>(() =>
            {
                testProp.FromString(serialValue, true);
            });
        }
        public void EmProperty_ToAndFromString_DataPreserved()
        {
            const string key          = "TestKey";
            var          orig         = new TestIntProperty(key, 10);
            var          deserialized = new TestIntProperty(key);

            string originalSerialized = orig.ToString();

            deserialized.FromString(originalSerialized);

            string serialized = deserialized.ToString();

            Assert.AreEqual(orig.Value, deserialized.Value);
            Assert.AreEqual(originalSerialized, serialized);
        }