public bool IsSame(DictionaryClass other) { if (Dict1 == null) { return(other.Dict1 == null); } if (Dict1.Count != other.Dict1.Count) { return(false); } return((Dict1.Count == 0) || ((Dict1["11"] == other.Dict1["11"]) && (Dict1["42"] == other.Dict1["42"]) && (Dict1["65"] == other.Dict1["65"]))); }
public void FilledDict() { var value = new DictionaryClass(true); var w = new Writer(); var cs = new ClassSerializer(typeof(DictionaryClass)); Assert.True(cs.Write(w, value, null)); Assert.AreEqual("!Test.DictionaryClass{Dict1:{\"11\":11,\"42\":42,\"65\":65}}", w.ToString()); var r = new Reader(w.ToString()); var result = cs.Read(r, null, null) as DictionaryClass; Assert.IsNotNull(result); Assert.IsFalse(r.AnyLeft, "Any characters left."); Assert.IsTrue(value.IsSame(result), "Read back value is not the same."); }