public LogAnalyzerService( IBinaryLogProcessor binaryLogProcessor, IGitHubAppModelService gitHubAppModelService, ILogger <LogAnalyzerService> logger) { _logger = logger; _binaryLogProcessor = binaryLogProcessor; _gitHubAppModelService = gitHubAppModelService; }
public BuildLogProcessor( IFileSystem fileSystem, IBinaryLogProcessor binaryLogProcessor, ILogger <BuildLogProcessor> logger = null) { _fileSystem = fileSystem; _binaryLogProcessor = binaryLogProcessor; Logger = logger ?? new NullLogger <BuildLogProcessor>(); }
private LogAnalyzerService CreateTarget( IBinaryLogProcessor binaryLogProcessor = null, IGitHubAppModelService gitHubAppModelService = null) { if (binaryLogProcessor == null) { binaryLogProcessor = Substitute.For <IBinaryLogProcessor>(); } if (gitHubAppModelService == null) { gitHubAppModelService = Substitute.For <IGitHubAppModelService>(); } return(new LogAnalyzerService(binaryLogProcessor, gitHubAppModelService, TestLogger.Create <LogAnalyzerService>(_testOutputHelper))); }
private CreateCheckRun GetCheckRun( IBinaryLogProcessor binaryLogProcessor, string inputFile = null, string cloneRoot = null, string owner = null, string repo = null, string hash = null, string configurationFile = null, MockFileSystem mockFileSystem = null) { inputFile = inputFile ?? Faker.System.FilePath(); cloneRoot = cloneRoot ?? Faker.System.DirectoryPath(); var outputFile = Faker.System.FilePath(); mockFileSystem = mockFileSystem ?? new MockFileSystem(); mockFileSystem.AddFile(inputFile, new MockFileData(string.Empty, Encoding.UTF8)); mockFileSystem.AddDirectory(Path.GetDirectoryName(outputFile)); var buildLogProcessor = new BuildLogProcessor(mockFileSystem, binaryLogProcessor, TestLogger.Create <BuildLogProcessor>(_testOutputHelper)); buildLogProcessor.Proces( inputFile, outputFile, cloneRoot, owner, repo, hash, configurationFile); mockFileSystem.FileExists(outputFile).Should().BeTrue(); var output = mockFileSystem.GetFile(outputFile).TextContents; output.Should().NotBeNullOrWhiteSpace(); return(JsonConvert.DeserializeObject <CreateCheckRun>(output)); }