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