This repository was archived by the owner on Nov 29, 2021. It is now read-only.

Description
The WebRequest is invalid, since it sets a wrong value to the Content-Length header. In the sample below, it sets it to 339 bytes, instead of 329 bytes. Notice that the overloaded method that accepts a byte[] works correctly.
Here's a failing test:
[TestMethod]
public void Can_Upload_File_Task_FAILS()
{
var localFile = new FileInfo(_fixture.CreateAnonymous<string>());
var localContent = _fixture.CreateAnonymous<string>();
File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
Assert.IsTrue(File.Exists(localFile.FullName));
using (var stream = new FileStream(localFile.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var uploadTask = _client.UploadFileTask("/Test", localFile.Name, stream);
uploadTask.Wait();
Assert.IsNotNull(uploadTask.Result);
}
}