public void ReadTestAreBuffersEqual() { // Arrange BasePack basePack = new BasePack(); byte[] buff = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; basePack.Write(buff, 0, buff.Length); // Act byte[] buffRead = new byte[buff.Length]; basePack.Read(buffRead, 0, buffRead.Length); // Assert CollectionAssert.AreEqual(buff, buffRead); }
public void WriteTestAreBuffersEqual() { // Arrange BasePack basePack = new BasePack(); byte[] buff = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // Act basePack.Write(buff, 0, buff.Length); // Assert - note that BasePack's buffer[0] is Pack's header, so written buffer is shifted by 1 to the right byte[] buffWritten = basePack.Buffer; for (int i = 0; i < buff.Length; i++) { Assert.AreEqual(buff[i], buffWritten[i + 1]); } }
public void WriteTestAreBuffersEqual() { // Arrange BasePack basePack = new BasePack(); byte[] buff = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // Act basePack.Write(buff, 0, buff.Length); // Assert - note that BasePack's buffer[0] is Pack's header, so written buffer is shifted by 1 to the right byte[] buffWritten = basePack.Buffer; for (int i = 0; i < buff.Length; i++) Assert.AreEqual(buff[i], buffWritten[i + 1]); }