public void TestPostBodyContainsFileContents() { provider.AddFile(new NamedFileStream("a", "b", "c", dummyFileStream)); StreamReader r = new StreamReader(provider.GetBody()); String content = r.ReadToEnd(); Assert.IsTrue(content.Contains("file")); }
public RequestBuilder Upload(NamedFileStream[] files, object parameters, Action<long,long?> onProgressChanged, Action<long> onUploadComplete) { MultipartBodyProvider bodyProvider = new MultipartBodyProvider(); bodyProvider.OnCompletedCallback = onUploadComplete; bodyProvider.OnProgressChangeCallback = onProgressChanged; foreach (NamedFileStream file in files) { bodyProvider.AddFile(file); } bodyProvider.SetParameters(parameters); return this.Body(bodyProvider); }
public RequestBuilder Upload(NamedFileStream[] files, object parameters, Action <long, long?> onProgressChanged, Action <long> onUploadComplete) { MultipartBodyProvider bodyProvider = new MultipartBodyProvider(); bodyProvider.OnCompletedCallback = onUploadComplete; bodyProvider.OnProgressChangeCallback = onProgressChanged; foreach (NamedFileStream file in files) { bodyProvider.AddFile(file); } bodyProvider.SetParameters(parameters); return(this.Body(bodyProvider)); }