public void TestUploadWithQueryAndPathParameters() { var stream = new MemoryStream(Encoding.UTF8.GetBytes(UploadTestData)); const int id = 123; var handler = new SingleChunkMessageHandler() { PathParameters = "testPath/" + id.ToString(), QueryParameters = "&queryA=valuea&queryB=VALUEB", StreamLength = stream.Length }; using (var service = new MockClientService(new BaseClientService.Initializer() { HttpClientFactory = new MockHttpClientFactory(handler) })) { var upload = new MockResumableWithParameters(service, "testPath/{id}", "POST", stream, "text/plain") { id = id, querya = "valuea", queryb = "VALUEB", }; upload.Upload(); Assert.That(handler.Calls, Is.EqualTo(2)); } }
public void TestUploadSingleChunk_ExactChunkSize() { var stream = new MemoryStream(Encoding.UTF8.GetBytes(UploadTestData)); var handler = new SingleChunkMessageHandler() { StreamLength = stream.Length }; using (var service = new MockClientService(new BaseClientService.Initializer() { HttpClientFactory = new MockHttpClientFactory(handler) })) { // Chunk size is the exact size we are sending. var upload = new MockResumableUpload(service, "", "POST", stream, "text/plain", UploadTestData.Length); upload.Upload(); } Assert.That(handler.Calls, Is.EqualTo(2)); }