Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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]);
            }
        }
Exemplo n.º 3
0
        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]);
        }
Exemplo n.º 4
0
        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);
        }