Ejemplo n.º 1
0
        public ReportCommandHandlerTests()
        {
            _handler = new ReportCommandHandler();

            _surface = new Mock <ISurface>();
            _robot   = new Mock <IRobot>();
        }
Ejemplo n.º 2
0
        public async Task Should_Return_TheDescriptions(string currentDir, string source, string[] desc)
        {
            // Arrange

            var fs = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { "C:/A/wtfd.json", MockData.NestedConfig(isRoot: true).config.ToMockFileData() },
            }, currentDir);

            MockData.AddDirectories(fs);

            var configs = (await new FindCommandHandler(fs).Handle(new FindRequest(), CancellationToken.None))
                          .Configurations;
            var reporter = new ReportCommandHandler(fs);

            // Act
            var result = await reporter.Handle(new ReportRequest
            {
                Configurations = configs
            }, CancellationToken.None);

            // Assert
            result.Source.ToPosixPath().Should().Be(source);
            result.Descriptions.Should().BeEquivalentTo(desc);
        }
Ejemplo n.º 3
0
        public ReportCommand()
            : base("report", "Creates a detailed graphical report on database schema and relationships.")
        {
            var outputOption = new Option <DirectoryInfo>(
                "--output",
                description: "The directory to save the generated report."
                )
            {
                Required = true
            };

            AddOption(outputOption);

            Handler = CommandHandler.Create <FileInfo, IConsole, DirectoryInfo, CancellationToken>((config, console, output, cancellationToken) =>
            {
                var handler = new ReportCommandHandler(config);
                return(handler.HandleCommandAsync(console, output, cancellationToken));
            });
        }
Ejemplo n.º 4
0
        public async Task Should_Return_NotFound()
        {
            // Arrange

            var fs = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { "C:/A/wtfd.json", MockData.NestedConfig(isRoot: true).config.ToMockFileData() },
            }, "C:/A/E/");

            MockData.AddDirectories(fs);

            var configs = (await new FindCommandHandler(fs).Handle(new FindRequest(), CancellationToken.None))
                          .Configurations;
            var reporter = new ReportCommandHandler(fs);

            // Act
            var result = await reporter.Handle(new ReportRequest
            {
                Configurations = configs
            }, CancellationToken.None);

            // Assert
            result.NotFound.Should().BeTrue();
        }