示例#1
0
        public void GetBytes()
        {
            var request = new IgnoreMessage(_data);

            var bytes = request.GetBytes();

            var expectedBytesLength = 0;

            expectedBytesLength += 1;            // Type
            expectedBytesLength += 4;            // Data length
            expectedBytesLength += _data.Length; // Data

            Assert.AreEqual(expectedBytesLength, bytes.Length);

            var sshDataStream = new SshDataStream(bytes);

            Assert.AreEqual(IgnoreMessage.MessageNumber, sshDataStream.ReadByte());
            Assert.AreEqual((uint)_data.Length, sshDataStream.ReadUInt32());

            var actualData = new byte[_data.Length];

            sshDataStream.Read(actualData, 0, actualData.Length);
            Assert.IsTrue(_data.SequenceEqual(actualData));

            Assert.IsTrue(sshDataStream.IsEndOfData);
        }
示例#2
0
        public void Load()
        {
            var ignoreMessage = new IgnoreMessage(_data);
            var bytes         = ignoreMessage.GetBytes();
            var target        = new IgnoreMessage();

            target.Load(bytes);

            Assert.IsNotNull(target.Data);
            Assert.AreEqual(_data.Length, target.Data.Length);
            Assert.IsTrue(target.Data.SequenceEqual(_data));
        }