@@ -10,12 +10,14 @@ namespace ManagedCode.Storage.IntegrationTests.Tests;
1010public abstract class BaseUploadControllerTests : BaseControllerTests
1111{
1212 private readonly string _uploadEndpoint ;
13- private readonly string _uploadChunksEndpoint ;
14-
13+ private readonly string _uploadChunksStreamEndpoint ;
14+ private readonly string _uploadChunksMergeEndpoint ;
15+
1516 protected BaseUploadControllerTests ( StorageTestApplication testApplication , string apiEndpoint ) : base ( testApplication , apiEndpoint )
1617 {
1718 _uploadEndpoint = string . Format ( ApiEndpoints . Base . UploadFile , ApiEndpoint ) ;
18- _uploadChunksEndpoint = string . Format ( ApiEndpoints . Base . UploadFileChunks , ApiEndpoint ) ;
19+ _uploadChunksStreamEndpoint = string . Format ( ApiEndpoints . Base . UploadFileChunksUsingStream , ApiEndpoint ) ;
20+ _uploadChunksMergeEndpoint = string . Format ( ApiEndpoints . Base . UploadFileChunksUsingMerge , ApiEndpoint ) ;
1921 }
2022
2123 [ Fact ]
@@ -116,7 +118,7 @@ public async Task UploadFileFromBase64String_WhenFileValid_ReturnSuccess()
116118 }
117119
118120 [ Fact ]
119- public async Task UploadFileInChunks_WhenFileValid_ReturnSuccess ( )
121+ public async Task UploadFileInChunksUsingStream_WhenFileValid_ReturnSuccess ( )
120122 {
121123 // Arrange
122124 var storageClient = GetStorageClient ( ) ;
@@ -127,11 +129,37 @@ public async Task UploadFileInChunks_WhenFileValid_ReturnSuccess()
127129 FileHelper . GenerateLocalFile ( localFile , 200 ) ;
128130
129131 // Act
130- var result = await storageClient . UploadLargeFile ( localFile . FileStream , _uploadChunksEndpoint + "/create" ,
131- _uploadChunksEndpoint + "/upload" , _uploadChunksEndpoint + "/complete" , null , new CancellationToken ( ) ) ;
132+ var result = await storageClient . UploadLargeFileUsingStream ( localFile . FileStream , _uploadChunksStreamEndpoint + "/create" ,
133+ _uploadChunksStreamEndpoint + "/upload" , _uploadChunksStreamEndpoint + "/complete" , null , new CancellationToken ( ) ) ;
134+
135+ // Assert
136+ result . IsSuccess . Should ( ) . BeTrue ( ) ;
137+ //result.Value.Should().NotBeNull();
138+ }
139+
140+ [ Fact ]
141+ public async Task UploadFileInChunksUsingMerge_WhenFileValid_ReturnSuccess ( )
142+ {
143+ // Arrange
144+ var storageClient = GetStorageClient ( ) ;
145+ var fileName = "test.txt" ;
146+ var contentName = "file" ;
147+
148+ await using var localFile = LocalFile . FromRandomNameWithExtension ( ".txt" ) ;
149+ FileHelper . GenerateLocalFile ( localFile , 200 ) ;
150+
151+ //Act
152+ var result = await storageClient . UploadLargeFileUsingMerge ( localFile . FileStream ,
153+ _uploadChunksMergeEndpoint + "/upload" ,
154+ _uploadChunksMergeEndpoint + "/complete" ,
155+ null ,
156+ new CancellationToken ( ) ) ;
132157
133158 // Assert
134159 result . IsSuccess . Should ( ) . BeTrue ( ) ;
135160 //result.Value.Should().NotBeNull();
136161 }
162+
163+ //Task<Result> UploadLargeFileUsingMerge(Stream file, string uploadApiUrl, string mergeApiUrl, Action<double>? onProgressChanged, CancellationToken cancellationToken);
164+
137165}
0 commit comments