@@ -153,6 +153,76 @@ public async Task DownloadFileGeminiTest()
153153 await geminiClient . Files . DownloadAsync ( file : file ) ;
154154 }
155155
156+ [ TestMethod ]
157+ public async Task DownloadVideoGeminiTest ( )
158+ {
159+ var video = new Google . GenAI . Types . Video {
160+ Uri = fileUri
161+ } ;
162+ var stream = await geminiClient . Files . DownloadAsync (
163+ video : video
164+ ) ;
165+ using ( MemoryStream memoryStream = new MemoryStream ( ) ) {
166+ await stream . CopyToAsync ( memoryStream ) ;
167+ memoryStream . Position = 0 ;
168+ byte [ ] bytes = memoryStream . ToArray ( ) ;
169+ // Replay mode does not return any bytes when downloading a file.
170+ if ( ! TestServer . IsReplayMode ) {
171+ Assert . IsTrue ( bytes . Length > 0 ) ;
172+ }
173+ }
174+ }
175+
176+ [ TestMethod ]
177+ public async Task DownloadVideoVertexTest ( )
178+ {
179+ var video = new Google . GenAI . Types . Video {
180+ Uri = "fileName"
181+ } ;
182+ var ex = await Assert . ThrowsExceptionAsync < NotSupportedException > ( async ( ) =>
183+ {
184+ await vertexClient . Files . DownloadAsync ( video : video ) ;
185+ } ) ;
186+
187+ StringAssert . Contains ( ex . Message , "This method is only supported in the Gemini Developer API client" ) ;
188+ }
189+
190+ [ TestMethod ]
191+ public async Task DownloadGeneratedVideoGeminiTest ( )
192+ {
193+ var video = new Google . GenAI . Types . Video {
194+ Uri = fileUri
195+ } ;
196+ var generatedVideo = new Google . GenAI . Types . GeneratedVideo { Video = video } ;
197+ var stream = await geminiClient . Files . DownloadAsync (
198+ generatedVideo : generatedVideo
199+ ) ;
200+ using ( MemoryStream memoryStream = new MemoryStream ( ) ) {
201+ await stream . CopyToAsync ( memoryStream ) ;
202+ memoryStream . Position = 0 ;
203+ byte [ ] bytes = memoryStream . ToArray ( ) ;
204+ // Replay mode does not return any bytes when downloading a file.
205+ if ( ! TestServer . IsReplayMode ) {
206+ Assert . IsTrue ( bytes . Length > 0 ) ;
207+ }
208+ }
209+ }
210+
211+ [ TestMethod ]
212+ public async Task DownloadGeneratedVideoVertexTest ( )
213+ {
214+ var video = new Google . GenAI . Types . Video {
215+ Uri = "fileName"
216+ } ;
217+ var generatedVideo = new Google . GenAI . Types . GeneratedVideo { Video = video } ;
218+ var ex = await Assert . ThrowsExceptionAsync < NotSupportedException > ( async ( ) =>
219+ {
220+ await vertexClient . Files . DownloadAsync ( generatedVideo : generatedVideo ) ;
221+ } ) ;
222+
223+ StringAssert . Contains ( ex . Message , "This method is only supported in the Gemini Developer API client" ) ;
224+ }
225+
156226 [ TestMethod ]
157227 public async Task DownloadToFileFileVertexTest ( )
158228 {
@@ -197,7 +267,6 @@ public async Task DownloadToFileVideoGeminiTest()
197267 await geminiClient . Files . DownloadToFileAsync ( video : video , outputPath : "output.mp4" ) ;
198268 }
199269
200-
201270 [ TestMethod ]
202271 public async Task DownloadToFileGeneratedVideoVertexTest ( )
203272 {
0 commit comments