public async Task Integration_VimeoClient_UploadEntireFile_UploadsFile_DoubleRead() { using (var file = new BinaryContent(GetFileFromEmbeddedResources(Testfilepath), "video/mp4")) { (await file.ReadAllAsync()).Length.ShouldBe(818086); (await file.ReadAllAsync()).Length.ShouldBe(818086); } }
public async Task ShouldCorrectlyDoubleRead() { using (var file = new BinaryContent(TestHelper.GetFileFromEmbeddedResources(TestHelper.TestFilePath), "video/mp4")) { (await file.ReadAllAsync()).Length.ShouldBe(5510872); (await file.ReadAllAsync()).Length.ShouldBe(5510872); } }
public void Integration_VimeoClient_UploadEntireFile_UploadsFile_InvalidStreams() { var nonReadablefile = new BinaryContent(new NonReadableStream(), "video/mp4"); var nonSeekablefile = new BinaryContent(new NonSeekableStream(), "video/mp4"); Should.ThrowAsync <InvalidOperationException>(async() => await nonReadablefile.ReadAllAsync(), "Content should be a readable Stream"); Should.ThrowAsync <InvalidOperationException>(async() => await nonSeekablefile.ReadAsync(10, 20), "Content cannot be advanced to the specified start index: 10"); }
public void Integration_VimeoClient_UploadEntireFile_UploadsFile_DisposedStreamAccess() { var file = new BinaryContent(GetFileFromEmbeddedResources(Testfilepath), "video/mp4"); file.Dispose(); Should.Throw <ObjectDisposedException>(() => file.Dispose()); Should.Throw <ObjectDisposedException>(() => file.Data.Length.ShouldBe(0)); Should.ThrowAsync <ObjectDisposedException>(async() => await file.ReadAllAsync()); }
public void ShouldFireExceptionWhenDisposedStreamAccess() { var file = new BinaryContent(TestHelper.GetFileFromEmbeddedResources(TestHelper.TestFilePath), "video/mp4"); file.Dispose(); Should.Throw <ObjectDisposedException>(() => file.Dispose()); Should.Throw <ObjectDisposedException>(() => file.Data.Length.ShouldBe(0)); Should.ThrowAsync <ObjectDisposedException>(async() => await file.ReadAllAsync()); }