public void GetBytes_TerminalModeValues_Null() { var target = new PseudoTerminalRequestInfo(_environmentVariable, _columns, _rows, _width, _height, null); var bytes = target.GetBytes(); var expectedBytesLength = 1; // WantReply expectedBytesLength += 4; // EnvironmentVariable length expectedBytesLength += _environmentVariableBytes.Length; // EnvironmentVariable expectedBytesLength += 4; // Columns expectedBytesLength += 4; // Rows expectedBytesLength += 4; // PixelWidth expectedBytesLength += 4; // PixelHeight expectedBytesLength += 4; // Length of "encoded terminal modes" Assert.AreEqual(expectedBytesLength, bytes.Length); var sshDataStream = new SshDataStream(bytes); Assert.AreEqual(1, sshDataStream.ReadByte()); // WantReply Assert.AreEqual(_environmentVariable, sshDataStream.ReadString(Encoding.UTF8)); Assert.AreEqual(_columns, sshDataStream.ReadUInt32()); Assert.AreEqual(_rows, sshDataStream.ReadUInt32()); Assert.AreEqual(_width, sshDataStream.ReadUInt32()); Assert.AreEqual(_height, sshDataStream.ReadUInt32()); Assert.AreEqual((uint) 0, sshDataStream.ReadUInt32()); Assert.IsTrue(sshDataStream.IsEndOfData); }
public void FullCtor() { var ptyReq = new PseudoTerminalRequestInfo(_environmentVariable, _columns, _rows, _width, _height, _terminalModeValues); Assert.IsTrue(ptyReq.WantReply); Assert.AreEqual(_columns, ptyReq.Columns); Assert.AreSame(_environmentVariable, ptyReq.EnvironmentVariable); Assert.AreEqual("pty-req", ptyReq.RequestName); Assert.AreEqual(_height, ptyReq.PixelHeight); Assert.AreEqual(_width, ptyReq.PixelWidth); Assert.AreEqual(_rows, ptyReq.Rows); Assert.AreSame(_terminalModeValues, ptyReq.TerminalModeValues); }
public void DefaultCtor() { var ptyReq = new PseudoTerminalRequestInfo(); Assert.IsTrue(ptyReq.WantReply); Assert.AreEqual(uint.MinValue, ptyReq.Columns); Assert.IsNull(ptyReq.EnvironmentVariable); Assert.AreEqual("pty-req", ptyReq.RequestName); Assert.AreEqual(uint.MinValue, ptyReq.PixelHeight); Assert.AreEqual(uint.MinValue, ptyReq.PixelWidth); Assert.AreEqual(uint.MinValue, ptyReq.Rows); Assert.IsNull(ptyReq.TerminalModeValues); }