コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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");
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        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());
        }