private void RefreshSarifErrors(string filePath) { ThreadHelper.JoinableTaskFactory.Run(async() => { await ErrorListService.CloseSarifLogItemsAsync(new string[] { filePath }); await ErrorListService.ProcessLogFileAsync(filePath, ToolFormat.None, promptOnLogConversions: true, cleanErrors: false, openInEditor: false); }); }
public async Task ErrorList_IsSarifLogOpened() { TestUtilities.InitializeTestEnvironment(); string logFileName1 = @"C:\git\repo\sarif-sdk\test_data\testresult1.sarif"; string logFileName2 = @"C:\git\repo\sarif-sdk\test_data\testtool2.sarif"; bool sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName1); sarifLogOpened.Should().BeFalse(); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName2); sarifLogOpened.Should().BeFalse(); // load sarif log 1 await TestUtilities.InitializeTestEnvironmentAsync(this.testLog, logFileName1); bool hasFirstError = SarifTableDataSource.Instance.HasErrors("/item1.cpp"); bool hasSecondError = SarifTableDataSource.Instance.HasErrors("/item2.cpp"); bool hasThirdError = SarifTableDataSource.Instance.HasErrors("/item3.cpp"); bool hasBothErrors = hasFirstError && hasSecondError && hasThirdError; hasBothErrors.Should().BeTrue(); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName1); sarifLogOpened.Should().BeTrue(); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName2); sarifLogOpened.Should().BeFalse(); // load sarif log 2 await TestUtilities.InitializeTestEnvironmentAsync(this.testLog, logFileName2, cleanErrors : false); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName1); sarifLogOpened.Should().BeTrue(); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName2); sarifLogOpened.Should().BeTrue(); // close sairf log 1 await ErrorListService.CloseSarifLogItemsAsync(new string[] { logFileName1 }); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName1); sarifLogOpened.Should().BeFalse(); sarifLogOpened = ErrorListService.IsSarifLogOpened(logFileName2); sarifLogOpened.Should().BeTrue(); }