Example #1
0
        /*
         * public void SendFileTest()
         * {
         *  Assert.Pass();
         * }*/
        public void ReceiveFileTest()
        {
            //Test to make sure that files are being received properly.

            Client         testClient   = new Client();
            RequestHeader  testHeader   = new PostRequestHeader("cheese.txt", testClient.key);
            ResponseHeader testResponse = new ResponseHeader();

            testClient.Connect("127.0.0.1", 9001);
            testClient.SendHeader(testHeader.ReturnRawHeader());
            // Not finished yet

            Assert.Pass();
        }
 private void sendButton_Click(object sender, EventArgs e)
 {
     try
     {
         string        file          = filePathBox.Text;
         RequestHeader clientHeader  = new PostRequestHeader(file, Program.client.key);
         byte[]        requestHeader = clientHeader.ReturnRawHeader();
         Program.client.SendHeader(requestHeader);
         messageBox.Text = Program.client.HandleResponse(true, file).Value;
     }
     catch (Exception ex)
     {
         messageBox.Text = ex.Message;
     }
 }
Example #3
0
        public void SendPostRequestTest()
        {
            Client testClient = new Client();

            byte[]        testFile   = File.ReadAllBytes(Path.Join(System.AppDomain.CurrentDomain.BaseDirectory, "cheese.txt"));
            RequestHeader testHeader = new PostRequestHeader("cheese.txt", testClient.key);

            testClient.Connect("127.0.0.1", 9001);
            testClient.SendHeader(testHeader.ReturnRawHeader());
            if (testClient.HandleResponse(true, "cheese.txt").Key == 0)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }