public void SarifFixer_ShouldNotChange_Valid()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            string testDir = TestUtils.CreateTestSpecificFolder(this.TestContext);

            string testSarifString = @"{
  ""version"": ""0.1"",
  ""toolInfo"": {
                ""toolName"": ""Microsoft (R) Visual C# Compiler"",
    ""productVersion"": ""1.0.0"",
    ""fileVersion"": ""1.0.0""
  },
  ""issues"": [
    {
      ""ruleId"": ""DD001"",
      ""locations"": [
        {
          ""analysisTarget"": [
            {
              ""uri"": ""C:\\agent\\_work\\2\\s\\MyTestProj\\Program.cs"",
}
          ]
        }
      ],
      ""shortMessage"": ""Test shortMessage. It features \""quoted text\""."",
      ""properties"": {
        ""severity"": ""Info"",
        ""helpLink"": ""https://github.com/SonarSource/sonar-msbuild-runner"",
      }
    }
  ]
}";
            string testSarifPath = Path.Combine(testDir, "testSarif.json");
            File.WriteAllText(testSarifPath, testSarifString);
            DateTime originalWriteTime = new FileInfo(testSarifPath).LastWriteTime;

            // Act
            string returnedSarifPath = new RoslynV1SarifFixer().LoadAndFixFile(testSarifPath, logger);

            // Assert
            // already valid -> no change to file, same file path returned
            AssertFileUnchanged(testSarifPath, originalWriteTime);
            Assert.AreEqual(testSarifPath, returnedSarifPath);
        }
        public void SarifFixer_ShouldChange_EscapeQuotes()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            string testDir = TestUtils.CreateTestSpecificFolder(this.TestContext);

            string testSarifString = @"{
  ""version"": ""0.1"",
  ""toolInfo"": {
                ""toolName"": ""Microsoft (R) Visual C# Compiler"",
    ""productVersion"": ""1.0.0"",
    ""fileVersion"": ""1.0.0""
  },
  ""issues"": [
    {
      ""ruleId"": ""DD001"",
      ""shortMessage"": ""Test shortMessage. It features ""quoted text""."",
      ""properties"": {
        ""severity"": ""Info"",
        ""helpLink"": ""https://github.com/SonarSource/sonar-msbuild-runner"",
      }
    }
  ]
}";
            string testSarifPath = Path.Combine(testDir, "testSarif.json");
            File.WriteAllText(testSarifPath, testSarifString);
            DateTime originalWriteTime = new FileInfo(testSarifPath).LastWriteTime;

            // Act
            string returnedSarifPath = new RoslynV1SarifFixer().LoadAndFixFile(testSarifPath, logger);

            // Assert
            // fixable -> no change to file, file path in return value, file contents as expected
            AssertFileUnchanged(testSarifPath, originalWriteTime);
            Assert.IsNotNull(returnedSarifPath);

            string returnedSarifString = File.ReadAllText(returnedSarifPath);
            Assert.AreEqual(@"{
  ""version"": ""0.1"",
  ""toolInfo"": {
                ""toolName"": ""Microsoft (R) Visual C# Compiler"",
    ""productVersion"": ""1.0.0"",
    ""fileVersion"": ""1.0.0""
  },
  ""issues"": [
    {
      ""ruleId"": ""DD001"",
      ""shortMessage"": ""Test shortMessage. It features \""quoted text\""."",
      ""properties"": {
        ""severity"": ""Info"",
        ""helpLink"": ""https://github.com/SonarSource/sonar-msbuild-runner"",
      }
    }
  ]
}", returnedSarifString);
        }
        public void SarifFixer_ShouldChange_EscapeBackslashes()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            string testDir = TestUtils.CreateTestSpecificFolder(this.TestContext);

            string testSarifString = @"{
  ""version"": ""0.1"",
  ""toolInfo"": {
                ""toolName"": ""Microsoft (R) Visual C# Compiler"",
    ""productVersion"": ""1.0.0"",
    ""fileVersion"": ""1.0.0""
  },
  ""issues"": [
    {
      ""ruleId"": ""DD001"",
      ""locations"": [
        {
          ""analysisTarget"": [
            {
              ""uri"": ""C:\agent\_work\2\s\MyTestProj\Program.cs"",
}
          ]
        }
      ],
    }
  ]
}";
            string testSarifPath = Path.Combine(testDir, "testSarif.json");
            File.WriteAllText(testSarifPath, testSarifString);
            DateTime originalWriteTime = new FileInfo(testSarifPath).LastWriteTime;

            // Act
            string returnedSarifPath = new RoslynV1SarifFixer().LoadAndFixFile(testSarifPath, logger);

            // Assert
            // fixable -> no change to file, file path in return value, file contents as expected
            AssertFileUnchanged(testSarifPath, originalWriteTime);
            Assert.IsNotNull(returnedSarifPath);

            string returnedSarifString = File.ReadAllText(returnedSarifPath);
            Assert.AreEqual(@"{
  ""version"": ""0.1"",
  ""toolInfo"": {
                ""toolName"": ""Microsoft (R) Visual C# Compiler"",
    ""productVersion"": ""1.0.0"",
    ""fileVersion"": ""1.0.0""
  },
  ""issues"": [
    {
      ""ruleId"": ""DD001"",
      ""locations"": [
        {
          ""analysisTarget"": [
            {
              ""uri"": ""C:\\agent\\_work\\2\\s\\MyTestProj\\Program.cs"",
}
          ]
        }
      ],
    }
  ]
}", returnedSarifString);
        }