public void ShouldParseDBATools()
        {
            var cloneRoot = @"c:\github\dbatools\bin\projects\dbatools\";

            var resourcePath = TestUtils.GetResourcePath("dbatools.binlog");

            File.Exists(resourcePath).Should().BeTrue();

            var parser          = new BinaryLogProcessor(TestLogger.Create <BinaryLogProcessor>(_testOutputHelper));
            var parsedBinaryLog = parser.ProcessLog(resourcePath, cloneRoot);

            parsedBinaryLog.SolutionDetails.CloneRoot.Should().Be(cloneRoot);

            var dbaToolsProject     = @"c:\github\dbatools\bin\projects\dbatools\dbatools\dbatools.csproj";
            var dbaToolsProjectPath = @"c:\github\dbatools\bin\projects\dbatools\dbatools";

            var dbaToolsTestProject     = @"c:\github\dbatools\bin\projects\dbatools\dbatools.Tests\dbatools.Tests.csproj";
            var dbaToolsTestProjectPath = @"c:\github\dbatools\bin\projects\dbatools\dbatools.Tests";

            var dbaToolsProjectDetails = parsedBinaryLog.SolutionDetails[dbaToolsProject];

            dbaToolsProjectDetails.ProjectFile.Should().Be(dbaToolsProject);
            dbaToolsProjectDetails.ProjectDirectory.Should().Be(dbaToolsProjectPath);

            var dbaToolsTestProjectDetails = parsedBinaryLog.SolutionDetails[dbaToolsTestProject];

            dbaToolsTestProjectDetails.ProjectFile.Should().Be(dbaToolsTestProject);
            dbaToolsTestProjectDetails.ProjectDirectory.Should().Be(dbaToolsTestProjectPath);

            parsedBinaryLog.SolutionDetails.Count(project => project.Value.ProjectFile.EndsWith(".csproj")).Should().Be(2);
            parsedBinaryLog.BuildMessages.Should().BeEmpty();
        }
        private BuildDetails ParseLogs(string resourceName, string cloneRoot)
        {
            var resourcePath = TestUtils.GetResourcePath(resourceName);

            File.Exists(resourcePath).Should().BeTrue();

            var parser = new BinaryLogProcessor(TestLogger.Create <BinaryLogProcessor>(_testOutputHelper));

            return(parser.ProcessLog(resourcePath, cloneRoot));
        }
        public void ShouldParseOctokitGraphQL()
        {
            var cloneRoot = @"C:\projects\octokit-graphql\";

            var resourcePath = TestUtils.GetResourcePath("octokit.graphql.binlog");

            File.Exists(resourcePath).Should().BeTrue();

            var parser          = new BinaryLogProcessor(TestLogger.Create <BinaryLogProcessor>(_testOutputHelper));
            var parsedBinaryLog = parser.ProcessLog(resourcePath, cloneRoot);
        }
        private LogData ProcessLog(string resourceName, string cloneRoot, string userName, string repo, string hash, CheckRunConfiguration checkRunConfiguration = null)
        {
            var resourcePath = TestUtils.GetResourcePath(resourceName);

            File.Exists(resourcePath).Should().BeTrue();

            var binaryLogReader = new BinaryLogReader();
            var logProcessor    = new BinaryLogProcessor(binaryLogReader, TestLogger.Create <BinaryLogProcessor>(_testOutputHelper));

            return(logProcessor.ProcessLog(resourcePath, cloneRoot, userName, repo, hash, checkRunConfiguration));
        }
        private async Task AssertSubmit(string file, string sha)
        {
            var resourcePath = TestUtils.GetResourcePath(file);
            var cloneRoot    = @"C:\projects\testconsoleapp1\";

            var startedAt    = DateTimeOffset.Now;
            var parser       = new BinaryLogProcessor(TestLogger.Create <BinaryLogProcessor>(_testOutputHelper));
            var buildDetails = parser.ProcessLog(resourcePath, cloneRoot);

            var gitHubAppClientFactory = CreateGitHubAppClientFactory();
            var gitHubAppModelService  = new GitHubAppModelService(gitHubAppClientFactory, CreateTokenGenerator());

            var msblocService = new LogAnalyzerService(parser, gitHubAppModelService, TestLogger.Create <LogAnalyzerService>(_testOutputHelper));
            var checkRun      = await msblocService.SubmitAsync(TestAppOwner, TestAppRepo, sha, cloneRoot, resourcePath);

            checkRun.Should().NotBeNull();
        }