Ejemplo n.º 1
0
        public async Task WriteRange(string fileName, string shareName, byte[] content, HttpStatusCode?expectedError)
        {
            FileRange          range   = new FileRange(0, content.Length - 1);
            HttpRequestMessage request = FileTests.WriteRangeRequest(FileContext, shareName, fileName, range, content.Length, null);

            Assert.IsTrue(request != null, "Failed to create HttpRequestMessage");

            request.Content = new ByteArrayContent(content);
            HttpResponseMessage response = await FileTestUtils.GetResponse(request, FileContext);

            try
            {
                FileTests.WriteRangeResponse(response, FileContext, expectedError);
            }
            finally
            {
                response.Dispose();
            }
        }
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();
            }
        }