File tree Expand file tree Collapse file tree
tests/PlateauResoniteLink.Tests/Targets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -210,6 +210,34 @@ public async Task GeoTiffTagReaderTryReadAsyncParsesGeoTiffTagsFromFileStream()
210210 Assert . NotNull ( snapshot . PixelScale ) ;
211211 }
212212
213+ [ Fact ]
214+ public async Task TryReadMetadataAsyncReturnsNullWhenFileCannotBeIdentifiedAsRaster ( )
215+ {
216+ using TemporaryDirectory workDirectory = new ( ) ;
217+ string rasterPath = Path . Combine ( workDirectory . Path , "not-a-raster.tif" ) ;
218+ await File . WriteAllTextAsync ( rasterPath , "not a raster" ) ;
219+
220+ GeoReferencedRasterMetadata ? metadata =
221+ await TerrainTextureGeoReferencedRasterMetadataReader . TryReadMetadataAsync (
222+ rasterPath ,
223+ CancellationToken . None ) ;
224+
225+ Assert . Null ( metadata ) ;
226+ }
227+
228+ [ Fact ]
229+ public async Task TryReadMetadataAsyncReturnsNullWhenStreamCannotBeIdentifiedAsRaster ( )
230+ {
231+ using MemoryStream stream = new ( "not a raster"u8 . ToArray ( ) ) ;
232+
233+ GeoReferencedRasterMetadata ? metadata =
234+ await TerrainTextureGeoReferencedRasterMetadataReader . TryReadMetadataAsync (
235+ stream ,
236+ CancellationToken . None ) ;
237+
238+ Assert . Null ( metadata ) ;
239+ }
240+
213241 [ Fact ]
214242 public void TryCropUsesMercatorVerticalInterpolationForEpsg3857 ( )
215243 {
You can’t perform that action at this time.
0 commit comments