Esempio n. 1
0
        public void WithMaskAndOverlay()
        {
            using var fileState = FileHelper.NewState();
            var tempDirectory = fileState.CreateTempDirectory();

            const string maskFilename      = "mask.jpg";
            const string overlayFilename   = "overlay.jpg";
            const string underlayFilename  = "underlay.jpg";
            const string satelliteFilename = "satellite.jpg";
            const string outputFilename    = "output.jpg";

            CreateImage(tempDirectory, maskFilename);
            CreateImage(tempDirectory, overlayFilename);
            CreateImage(tempDirectory, underlayFilename);
            CreateImage(tempDirectory, satelliteFilename);

            var outputPath = Path.Combine(tempDirectory, outputFilename);

            // Run method under test
            Sanchez.Main(
                "-s", Path.Combine(tempDirectory, satelliteFilename),
                "-m", Path.Combine(tempDirectory, maskFilename),
                "-u", Path.Combine(tempDirectory, underlayFilename),
                "-O", Path.Combine(tempDirectory, overlayFilename),
                "-o", outputPath,
                "-t", "00BBFF"
                );

            File.Exists(outputPath).Should().BeTrue("output file should have been created");
            using var outputImage = Image.Load(outputPath);
            outputImage.Width.Should().Be(2000);
            outputImage.Height.Should().Be(2000);
        }
Esempio n. 2
0
        public void ValidInputFilesRequired()
        {
            using var fileState = FileHelper.NewState();
            var tempDirectory = fileState.CreateTempDirectory();

            const string underlayFilename = "underlay.jpg";
            const string outputFilename   = "output.jpg";

            CreateImage(tempDirectory, underlayFilename);

            var outputPath = Path.Combine(tempDirectory, outputFilename);

            // Run method under test
            Sanchez.Main(
                "-s", "biscuits",
                "-u", Path.Combine(tempDirectory, underlayFilename),
                "-o", outputPath
                );

            File.Exists(outputPath).Should().BeFalse("output file should not have been created if input files were missing");
        }
Esempio n. 3
0
        public void ValidOutputFormatRequired()
        {
            using var fileState = FileHelper.NewState();
            var tempDirectory = fileState.CreateTempDirectory();

            const string underlayFilename  = "underlay.jpg";
            const string satelliteFilename = "satellite.jpg";
            const string outputFilename    = "output.bogus";

            CreateImage(tempDirectory, underlayFilename);
            CreateImage(tempDirectory, satelliteFilename);

            var outputPath = Path.Combine(tempDirectory, outputFilename);

            // Run method under test
            Sanchez.Main(
                "-s", Path.Combine(tempDirectory, satelliteFilename),
                "-u", Path.Combine(tempDirectory, underlayFilename),
                "-o", outputPath
                );

            File.Exists(outputPath).Should().BeFalse("no output file should be written if the output format can't be determined");
        }