Пример #1
0
		public void Test_05_Download_A_Particular_Version()
		{
			byte[] bufV1 = new byte[100];
			byte[] bufV2 = new byte[200];
			byte[] bufV3 = new byte[300];

            Proxy.UploaderRef.Uploader uploader = new Proxy.UploaderRef.Uploader( );
			uploader.Url = Globals.UploaderUrl();
			uploader.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");
			string docUrl = Globals.DocumentLibForUploadTesting()+"/Uploaded.doc";

			if (uploader.DocumentExists(docUrl))
				uploader.Delete(docUrl);

			uploader.Upload(bufV1, docUrl);
			uploader.Upload(bufV2, docUrl);
			uploader.Upload(bufV3, docUrl);

			byte[] downloaded = uploader.DownloadVersion(docUrl, 1);
			Assert.IsTrue(downloaded.Length == 100, "Failed to download the expected document version: 1");
			downloaded = uploader.DownloadVersion(docUrl, 2);
			Assert.IsTrue(downloaded.Length == 200, "Failed to download the expected document version: 2");
			downloaded = uploader.DownloadVersion(docUrl, 3);
			Assert.IsTrue(downloaded.Length == 300, "Failed to download the expected document version: 3");
		}