Esempio n. 1
0
        private void Test_Download(string downloadDocUrl, string referenceFilename)
        {
            Proxy.UploaderRef.Uploader uploader = new Proxy.UploaderRef.Uploader( );
            uploader.Url = Globals.UploaderUrl();
            uploader.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");

            if (uploader.DocumentExists(downloadDocUrl))
                uploader.Delete(downloadDocUrl);
            Helper_EnsureDocumentIsThereForTesting(downloadDocUrl, referenceFilename);

            byte[] fileBuf = uploader.Download(downloadDocUrl);
            byte[] refFileBuf = Helper_ReadLocalFile(referenceFilename);

            Assert.IsTrue(fileBuf != null, "Failed to download the document from SharePoint.");
            Assert.IsTrue(refFileBuf != null, "Failed to load the test file.  Test can't run.");
            
            //TODO: why aren't the files the same size?
            //Assert.AreSame(fileBuf, refFileBuf);
            //Assert.IsTrue(fileBuf.Length > 0 && fileBuf.Length == refFileBuf.Length, "Didn't read all the bytes we are expecting!");
        }