Esempio n. 1
0
        public void Test2()
        {
            var protocol = new FCP2Protocol("test-client");

            protocol.ClientHello();

            protocol.DataFoundEvent += Protocol_DataFoundEvent;
            protocol.AllDataEvent   += Protocol_AllDataEvent;

            const string TestIdentifier = "test-file";

            protocol.ClientGet("CHK@khy~PN5-P-Ze18SdPfb~eMVCcWv1RTDNaP3ketO3TwQ,-kcC5FBaNN7wZtcHgZGObkxk9221BL5r~wbbVTUhyHc,AAMC--8/test.txt", TestIdentifier);

            int retry = 1000;

            while (--retry > 0 && !Ready())
            {
                System.Threading.Thread.Sleep(100);
            }

            const int    TestSize        = 16;
            const string TestContentType = "text/plain";
            const string TestData        = "this is a test\r\n";

            Assert.IsNotNull(allData);
            Assert.IsNotNull(dataFound);

            Assert.AreEqual(TestSize, dataFound.Datalength);
            Assert.AreEqual(TestIdentifier, dataFound.Identifier);
            Assert.IsFalse(dataFound.Global);
            Assert.AreEqual(TestContentType, dataFound.ContentType);

            Assert.IsTrue(allData.StartupTime <= allData.CompletionTime);

            Assert.AreEqual(TestSize, allData.Datalength);
            Assert.AreEqual(TestIdentifier, allData.Identifier);
            Assert.AreEqual(TestData, testData.ToString());

            protocol.Disconnect();
        }
Esempio n. 2
0
 public void StartDownload()
 {
     _client.ClientGet(_key, ID, verbosity: VerbosityEnum.SimpleMessages);
 }