Ejemplo n.º 1
0
        public void PutFileScenarioTest(string shareName, string fileName, FileProperties properties, byte[] content, HttpStatusCode?expectedError)
        {
            HttpWebRequest request = FileTests.PutFileRequest(FileContext, shareName, fileName, properties, content, content.Length, null);

            Assert.IsTrue(request != null, "Failed to create HttpWebRequest");
            request.ContentLength = content.Length;
            if (FileContext.Credentials != null)
            {
                FileTests.SignRequest(request, FileContext);
            }
            FileTestUtils.SetRequest(request, FileContext, content);
            HttpWebResponse response = FileTestUtils.GetResponse(request, FileContext);

            try
            {
                FileTests.PutFileResponse(response, FileContext, expectedError);
            }
            finally
            {
                response.Close();
            }
        }
Ejemplo n.º 2
0
        public void WriteRange(string fileName, string shareName, byte[] content, HttpStatusCode?expectedError)
        {
            FileRange      range   = new FileRange(0, content.Length - 1);
            HttpWebRequest request = FileTests.WriteRangeRequest(FileContext, shareName, fileName, range, content.Length, null);

            Assert.IsTrue(request != null, "Failed to create HttpWebRequest");
            if (FileContext.Credentials != null)
            {
                FileTests.SignRequest(request, FileContext);
            }
            FileTestUtils.SetRequest(request, FileContext, content);
            HttpWebResponse response = FileTestUtils.GetResponse(request, FileContext);

            try
            {
                FileTests.WriteRangeResponse(response, FileContext, expectedError);
            }
            finally
            {
                response.Close();
            }
        }