public void EmPropertyList_ToAndFromString_DataPreserved() { var values = new List <int> { 1, 2, 3, 4, 5 }; const string key = "TestKey"; var orig = new TestSimpleIntList(key, values); var deserialized = new TestSimpleIntList(key); string originalSerialized = orig.ToString(); deserialized.FromString(originalSerialized); string serialized = deserialized.ToString(); Assert.AreEqual(values.Count, orig.Count); for (int i = 0; i < deserialized.Count; i++) { Assert.AreEqual(values[i], orig[i]); } Assert.AreEqual(originalSerialized, serialized); }
public void EmPropertyIntList_FromString_GoodString_GetExpected(string goodString) { var values = new List <int> { 1, 2, 3, 4, 5 }; var testProp = new TestSimpleIntList("TestKey"); testProp.FromString(goodString); Assert.AreEqual(values.Count, testProp.Count); for (int i = 0; i < testProp.Count; i++) { Assert.AreEqual(values[i], testProp[i]); } }
public void EmPropertyList_ToString_GetExpected() { const string key = "TestKey"; var values = new List <int>(5) { 1, 2, 3, 4, 5, }; var testProp = new TestSimpleIntList(key, values); string expectedValue = $"{key}:1,2,3,4,5;"; Assert.AreEqual(values.Count, testProp.Count); for (int i = 0; i < testProp.Count; i++) { Assert.AreEqual(values[i], testProp[i]); } Assert.AreEqual(expectedValue, testProp.ToString()); }