forked from DMS-Aus/MapManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriverTest.cs
More file actions
68 lines (64 loc) · 2.28 KB
/
Copy pathDriverTest.cs
File metadata and controls
68 lines (64 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.IO;
using System.Linq;
using MapManager.Apis;
using MapManager.Apis.Gdal;
using Serilog;
using Serilog.Events;
using Xunit;
namespace MapManager.Tests.Apis.Gdal
{
public class DriverTest
{
public DriverTest(ITestOutputHelper output)
{
Log = new LoggerConfiguration()
.MinimumLevel.Debug()
// .WriteTo.TestOutput(output, LogEventLevel.Debug,
// "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] [{SourceContext}] {Message}{NewLine}{Exception}")
.Enrich.FromLogContext()
.CreateLogger()
.ForContext<DriverTest>();
Logger.Init(Log);
}
private ILogger Log { get; }
[Fact]
public void DriverNames()
{
var driverNames = Driver.Names.ToArray();
Log.Debug("Driver Name Count: {DriverNameCount}", driverNames.Length);
Assert.Equal(Driver.GdalDriverPath == null ? 209 : 221, driverNames.Length);
var firstFiveDrivers = driverNames.Take(5).ToArray();
Assert.Equal(Driver.GdalDriverPath == null ? new[]
{
"Virtual Raster",
"Derived datasets using VRT pixel functions",
"GeoTIFF",
"National Imagery Transmission Format",
"Raster Product Format TOC format"
} : new []
{
"Bathymetry Attributed Grid",
"Flexible Image Transport System",
"GMT NetCDF Grid Format",
"Hierarchical Data Format Release 4",
"HDF4 Dataset"
}, firstFiveDrivers);
var lastFiveDrivers = driverNames.Skip(driverNames.Length-5).Take(5).ToArray();
Assert.Equal(new[]
{
"Generic Binary (.hdr Labelled)",
"ENVI .hdr Labelled",
"ESRI .hdr Labelled",
"ISCE raster",
"HTTP Fetching Wrapper"
}, lastFiveDrivers);
}
[Fact]
public void SetGdalDriverPathEnvironment()
{
var gdalPlugins = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "gdalplugins"));
Driver.GdalDriverPath = gdalPlugins;
}
}
}