Beispiel #1
0
        public void TestAddString()
        {
            BlobBuilder builder = new BlobBuilder();
            string      value   = "test string";

            builder.AddStringBlob(value);
            byte[] valueBytes = Encoding.UTF8.GetBytes(value);
            byte[] expected   = new byte[valueBytes.Length + 4];
            Array.Copy(valueBytes.Length.ToBytes(), expected, 4);
            Array.Copy(valueBytes, 0, expected, 4, valueBytes.Length);
            Assert.That(builder.GetBlob(), Is.EqualTo(expected));
        }
Beispiel #2
0
        public void SendMessageTest()
        {
            // TODO: Need to modify this test so that it does not use PageantAgent
            const string messageValue = "junk";

            var builder = new BlobBuilder();

            builder.AddStringBlob(messageValue);
            var messageBytes = builder.GetBlob();

            using (var agent = new PageantAgent()) {
                var client      = new PageantClient();
                var reply       = client.SendMessage(messageBytes);
                var replyParser = new BlobParser(reply);
                var replyHeader = replyParser.ReadHeader();
                Assert.That(replyHeader.Message, Is.EqualTo(Agent.Message.SSH_AGENT_FAILURE));
            }
        }