|
|
@ -90,11 +90,13 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_upload_asset_using_tus_in_chunks() |
|
|
public async Task Should_upload_asset_using_tus_in_chunks() |
|
|
|
|
|
{ |
|
|
|
|
|
for (var i = 0; i < 5; i++) |
|
|
{ |
|
|
{ |
|
|
// STEP 1: Create asset
|
|
|
// STEP 1: Create asset
|
|
|
var fileParameter = FileParameter.FromPath("Assets/SampleVideo_1280x720_1mb.mp4"); |
|
|
var fileParameter = FileParameter.FromPath("Assets/SampleVideo_1280x720_1mb.mp4"); |
|
|
|
|
|
|
|
|
var pausingStream = new PauseStream(fileParameter.Data, 0.25); |
|
|
var pausingStream = new PauseStream(fileParameter.Data, 0.5); |
|
|
var pausingFile = new FileParameter(pausingStream, fileParameter.FileName, fileParameter.ContentType); |
|
|
var pausingFile = new FileParameter(pausingStream, fileParameter.FileName, fileParameter.ContentType); |
|
|
|
|
|
|
|
|
var numUploads = 0; |
|
|
var numUploads = 0; |
|
|
@ -111,11 +113,6 @@ namespace TestSuite.ApiTests |
|
|
{ |
|
|
{ |
|
|
pausingStream.Reset(); |
|
|
pausingStream.Reset(); |
|
|
|
|
|
|
|
|
if (pausingStream.Position == pausingStream.Length) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new InvalidOperationException("Stream end reached."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await _.Assets.UploadNewAssetAsync(_.AppName, pausingFile, new AssetUploadOptions |
|
|
await _.Assets.UploadNewAssetAsync(_.AppName, pausingFile, new AssetUploadOptions |
|
|
{ |
|
|
{ |
|
|
ProgressHandler = new AssetDelegatingProgressHandler |
|
|
ProgressHandler = new AssetDelegatingProgressHandler |
|
|
@ -169,6 +166,7 @@ namespace TestSuite.ApiTests |
|
|
Assert.Equal(stream.Length, downloaded.Length); |
|
|
Assert.Equal(stream.Length, downloaded.Length); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_upload_asset_with_custom_id() |
|
|
public async Task Should_upload_asset_with_custom_id() |
|
|
@ -282,6 +280,8 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_replace_asset_using_tus_in_chunks() |
|
|
public async Task Should_replace_asset_using_tus_in_chunks() |
|
|
|
|
|
{ |
|
|
|
|
|
for (var i = 0; i < 5; i++) |
|
|
{ |
|
|
{ |
|
|
// STEP 1: Create asset
|
|
|
// STEP 1: Create asset
|
|
|
var asset_1 = await _.UploadFileAsync("Assets/logo-squared.png", "image/png"); |
|
|
var asset_1 = await _.UploadFileAsync("Assets/logo-squared.png", "image/png"); |
|
|
@ -290,7 +290,7 @@ namespace TestSuite.ApiTests |
|
|
// STEP 2: Reupload asset
|
|
|
// STEP 2: Reupload asset
|
|
|
var fileParameter = FileParameter.FromPath("Assets/SampleVideo_1280x720_1mb.mp4"); |
|
|
var fileParameter = FileParameter.FromPath("Assets/SampleVideo_1280x720_1mb.mp4"); |
|
|
|
|
|
|
|
|
var pausingStream = new PauseStream(fileParameter.Data, 0.25); |
|
|
var pausingStream = new PauseStream(fileParameter.Data, 0.5); |
|
|
var pausingFile = new FileParameter(pausingStream, fileParameter.FileName, fileParameter.ContentType); |
|
|
var pausingFile = new FileParameter(pausingStream, fileParameter.FileName, fileParameter.ContentType); |
|
|
|
|
|
|
|
|
var numUploads = 0; |
|
|
var numUploads = 0; |
|
|
@ -307,11 +307,6 @@ namespace TestSuite.ApiTests |
|
|
{ |
|
|
{ |
|
|
pausingStream.Reset(); |
|
|
pausingStream.Reset(); |
|
|
|
|
|
|
|
|
if (pausingStream.Position == pausingStream.Length) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new InvalidOperationException("Stream end reached."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await _.Assets.UploadExistingAssetAsync(_.AppName, asset_1.Id, pausingFile, new AssetUploadOptions |
|
|
await _.Assets.UploadExistingAssetAsync(_.AppName, asset_1.Id, pausingFile, new AssetUploadOptions |
|
|
{ |
|
|
{ |
|
|
ProgressHandler = new AssetDelegatingProgressHandler |
|
|
ProgressHandler = new AssetDelegatingProgressHandler |
|
|
@ -365,6 +360,7 @@ namespace TestSuite.ApiTests |
|
|
Assert.Equal(stream.Length, downloaded.Length); |
|
|
Assert.Equal(stream.Length, downloaded.Length); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_annote_asset() |
|
|
public async Task Should_annote_asset() |
|
|
|