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(); } }