private static CommandLineOptions ValidOptions(FileState fileState) { var options = new CommandLineOptions { OutputPath = fileState.CreateFile("output.jpg"), UnderlayPath = fileState.CreateFile("underlay.jpg"), SourcePath = fileState.CreateFile("source.jpg"), OverlayPath = fileState.CreateFile("overlay.jpg"), Threads = 5 }; return(options); }
public void LocateImages() { RenderOptions.EquirectangularRender = new EquirectangularRenderOptions(false, true, null); var targetTimestamp = new DateTime(2020, 08, 30, 03, 30, 00, DateTimeKind.Utc); RenderOptions.Tolerance = TimeSpan.FromMinutes(30); using var state = new FileState(); var rootDirectory = state.CreateTempDirectory(); RenderOptions.SourcePath = rootDirectory; // Create sample files state.CreateFile(rootDirectory, "GOES16_FD_CH13_20200830T035020Z.jpg"); state.CreateFile(rootDirectory, "GOES16_FD_CH13_20200830T033020Z.jpg"); state.CreateFile(rootDirectory, "GOES16_FD_CH13_20200930T033020Z.jpg"); state.CreateFile(rootDirectory, "GOES16_FD_CH13_bogus.jpg"); var directory = Directory.CreateDirectory(Path.Combine(rootDirectory, "GOES17")); state.CreateFile(directory.FullName, "GOES17_FD_CH13_20200830T033031Z.jpg"); directory = Directory.CreateDirectory(Path.Combine(rootDirectory, "Himawari-8")); state.CreateFile(directory.FullName, "Himawari8_FD_IR_20200830T035100Z.jpg"); state.CreateFile(directory.FullName, "bogus.jpg"); // Run method under test var sourceFiles = FileService.GetSourceFiles(); var registrations = FileService.ToRegistrations(sourceFiles); var matchedFiles = Matcher.FilterMatchingRegistrations(registrations, targetTimestamp).Select(r => Path.GetFileName(r.Path)); matchedFiles.Should().BeEquivalentTo("GOES16_FD_CH13_20200830T033020Z.jpg", "GOES17_FD_CH13_20200830T033031Z.jpg", "Himawari8_FD_IR_20200830T035100Z.jpg"); }
public void ValidOutputStitchNoBatch() { var options = ValidOptions(); using var state = new FileState(); var outputFile = state.CreateFile("foo.jpg"); options.Timestamp = DateTime.Now; options.SourcePath = Path.Combine(state.CreateTempDirectory(), "*.jpg"); options.OutputPath = outputFile; VerifyNoFailure(options); }
public void OutputNotFileIfMultipleSource() { var options = ValidOptions(); using var state = new FileState(); var outputFile = state.CreateFile("foo.jpg"); options.SourcePath = Path.Combine(state.CreateTempDirectory(), "*.jpg"); options.OutputPath = outputFile; VerifyFailure( options, nameof(GeostationaryOptions.OutputPath), "If multiple source files are specified, the output must be a directory."); }