public void Serialize2() { for (int i = 0; i < 160; i++) { StateArray sourceStateArray = new StateArray(64); sourceStateArray[i] = true; byte[] serializedBytes = new byte[8]; { OutgoingMessage outgoingMessage = new OutgoingMessage(serializedBytes); sourceStateArray.Serialize(outgoingMessage); } StateArray destinationStateArray = new StateArray(64); { IncomingMessage incomingMessage = new IncomingMessage(serializedBytes); destinationStateArray.Deserialize(incomingMessage); } for (int k = 0; k < 160; k++) { if (k == i) { Assert.IsTrue(destinationStateArray[k]); } else { Assert.IsFalse(destinationStateArray[k]); } } } }
public void Serialize1() { StateArray sourceStateArray = new StateArray(64); sourceStateArray[0] = true; sourceStateArray[1] = true; sourceStateArray[8] = true; sourceStateArray[32] = true; sourceStateArray[33] = true; sourceStateArray[62] = true; sourceStateArray[63] = true; byte[] serializedBytes = new byte[8]; { OutgoingMessage outgoingMessage = new OutgoingMessage(serializedBytes); sourceStateArray.Serialize(outgoingMessage); serializedBytes = outgoingMessage.ToArray(); } StateArray destinationStateArray = new StateArray(64); { IncomingMessage incomingMessage = new IncomingMessage(serializedBytes); destinationStateArray.Deserialize(incomingMessage); } for (int i = 0; i < 64; i++) { if (i == 0 || i == 1 || i == 8 || i == 32 || i == 33 || i == 62 || i == 63) { Assert.IsTrue(destinationStateArray[i]); } else { Assert.IsFalse(destinationStateArray[i]); } } }