diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 2208a7fd0..b7ec02f05 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -8,39 +8,40 @@
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Test.UnitTests.Sarif.Converters/CppCheckErrorTests.cs b/src/Test.UnitTests.Sarif.Converters/CppCheckErrorTests.cs
index 3ea007441..88ecdcba4 100644
--- a/src/Test.UnitTests.Sarif.Converters/CppCheckErrorTests.cs
+++ b/src/Test.UnitTests.Sarif.Converters/CppCheckErrorTests.cs
@@ -86,7 +86,7 @@ public void CppCheckError_ErrorWithMultipleLocationsFillsOutCodeFlow()
}
}, Location.ValueComparer).Should().BeTrue();
- Assert.Equal(1, result.CodeFlows.Count);
+ Assert.Single(result.CodeFlows);
result.CodeFlows.First().ThreadFlows.First().Locations.SequenceEqual(new[]
{
new ThreadFlowLocation {
diff --git a/src/Test.UnitTests.Sarif.Converters/FortifyConverterTests.cs b/src/Test.UnitTests.Sarif.Converters/FortifyConverterTests.cs
index 387671a35..2bd67400d 100644
--- a/src/Test.UnitTests.Sarif.Converters/FortifyConverterTests.cs
+++ b/src/Test.UnitTests.Sarif.Converters/FortifyConverterTests.cs
@@ -196,7 +196,7 @@ public void FortifyConverter_Convert_UsesPrimaryAsMainLocation()
Builder builder = FortifyConverterTests.GetBasicBuilder();
builder.Source = FortifyConverterTests.s_dummyPathSourceElement;
Result result = FortifyConverter.ConvertFortifyIssueToSarifIssue(builder.ToImmutable());
- Assert.Equal(1, result.Locations.Count);
+ Assert.Single(result.Locations);
Assert.Equal("filePath", result.Locations.First().PhysicalLocation.ArtifactLocation.Uri.ToString());
Assert.True(result.Locations.First().PhysicalLocation.Region.ValueEquals(new Region { StartLine = 1729 }));
}
@@ -214,7 +214,7 @@ public void FortifyConverter_Convert_FillsInCodeFlowWhenSourceIsPresent()
Builder builder = FortifyConverterTests.GetBasicBuilder();
builder.Source = FortifyConverterTests.s_dummyPathSourceElement;
Result result = FortifyConverter.ConvertFortifyIssueToSarifIssue(builder.ToImmutable());
- Assert.Equal(1, result.CodeFlows.Count);
+ Assert.Single(result.CodeFlows);
IList flowLocations = result.CodeFlows.First().ThreadFlows.First().Locations;
Assert.Equal("sourceFilePath", flowLocations[0].Location.PhysicalLocation.ArtifactLocation.Uri.ToString());
Assert.True(flowLocations[0].Location.PhysicalLocation.Region.ValueEquals(new Region { StartLine = 42 }));
diff --git a/src/Test.UnitTests.Sarif.Multitool.Library/GenericCommandTests.cs b/src/Test.UnitTests.Sarif.Multitool.Library/GenericCommandTests.cs
index dac85451b..b96d61675 100644
--- a/src/Test.UnitTests.Sarif.Multitool.Library/GenericCommandTests.cs
+++ b/src/Test.UnitTests.Sarif.Multitool.Library/GenericCommandTests.cs
@@ -45,7 +45,7 @@ private void CheckTypeForDuplicateArgumentNames(Type type)
{
if (parameters.ContainsKey(result.ShortName))
{
- Assert.True(false, $"{type.Name} has a conflict for {result.ShortName} between {result.LongName} and {parameters[result.ShortName].LongName}.");
+ Assert.Fail($"{type.Name} has a conflict for {result.ShortName} between {result.LongName} and {parameters[result.ShortName].LongName}.");
}
parameters[result.ShortName] = result;
diff --git a/src/Test.UnitTests.Sarif/Core/SarifLogTests.cs b/src/Test.UnitTests.Sarif/Core/SarifLogTests.cs
index 42d73001e..48e87a405 100644
--- a/src/Test.UnitTests.Sarif/Core/SarifLogTests.cs
+++ b/src/Test.UnitTests.Sarif/Core/SarifLogTests.cs
@@ -413,7 +413,7 @@ await SarifLog.Post(postUri,
}
catch (Exception ex)
{
- Assert.True(false, $"Unhandled exception: {ex}");
+ Assert.Fail($"Unhandled exception: {ex}");
}
}
@@ -444,7 +444,7 @@ await SarifLog.Post(postUri,
}
catch (Exception ex)
{
- Assert.True(false, $"Unhandled exception: {ex}");
+ Assert.Fail($"Unhandled exception: {ex}");
}
httpMock.Clear();
}
diff --git a/src/Test.UnitTests.Sarif/HashUtilitiesTests.cs b/src/Test.UnitTests.Sarif/HashUtilitiesTests.cs
index 594f1e6ff..c4d1fe4ce 100644
--- a/src/Test.UnitTests.Sarif/HashUtilitiesTests.cs
+++ b/src/Test.UnitTests.Sarif/HashUtilitiesTests.cs
@@ -47,7 +47,7 @@ public void HashUtilities_ShouldRespectQuietFlag()
if (File.Exists(filePath)) { File.Delete(filePath); }
}
- Assert.True(false, e.Message);
+ Assert.Fail(e.Message);
}
// An custom textwriter.S
@@ -67,7 +67,7 @@ public void HashUtilities_ShouldRespectQuietFlag()
}
Console.SetOut(defaultOut);
- Assert.True(false, "Exception was expected but not thrown");
+ Assert.Fail("Exception was expected but not thrown");
}
catch (InvalidOperationException)
{
@@ -81,7 +81,7 @@ public void HashUtilities_ShouldRespectQuietFlag()
}
catch
{
- Assert.True(false, "Unexpected exception.");
+ Assert.Fail("Unexpected exception.");
}
finally
{
diff --git a/src/Test.UnitTests.Sarif/Writers/SarifConsolidatorTests.cs b/src/Test.UnitTests.Sarif/Writers/SarifConsolidatorTests.cs
index 75af51b12..f2ed485e2 100644
--- a/src/Test.UnitTests.Sarif/Writers/SarifConsolidatorTests.cs
+++ b/src/Test.UnitTests.Sarif/Writers/SarifConsolidatorTests.cs
@@ -191,7 +191,7 @@ public void SarifConsolidator_Locations()
};
IList result = consolidator.Trim(locations);
- Assert.Equal(1, result.Count);
+ Assert.Single(result);
Assert.Null(result[0].PhysicalLocation.ArtifactLocation.UriBaseId);
Assert.Equal(-1, result[0].PhysicalLocation.Region.CharOffset);
}
@@ -209,7 +209,7 @@ public void SarifConsolidator_LogicalLocations()
};
IList result = consolidator.Trim(locations);
- Assert.Equal(1, result.Count);
+ Assert.Single(result);
Assert.Null(result[0].Name);
}
diff --git a/src/Test.UnitTests.Sarif/Writers/SarifLoggerTests.cs b/src/Test.UnitTests.Sarif/Writers/SarifLoggerTests.cs
index e4649758d..5bcecde45 100644
--- a/src/Test.UnitTests.Sarif/Writers/SarifLoggerTests.cs
+++ b/src/Test.UnitTests.Sarif/Writers/SarifLoggerTests.cs
@@ -166,7 +166,7 @@ public void SarifLogger_RedactedCommandLine()
}
else
{
- Assert.False(true, pathToExe + " " + commandLine);
+ Assert.Fail(pathToExe + " " + commandLine);
}
using (_ = new SarifLogger(textWriter,
@@ -1052,7 +1052,7 @@ private void TestForLoggingOption(FilePersistenceOptions loggingOption)
}
catch (Exception e)
{
- Assert.True(false, e.ToString());
+ Assert.Fail(e.ToString());
}
finally
{
@@ -1452,7 +1452,7 @@ public void SarifLogger_AnalyzingTarget_PersistsMultipleTargets()
// 'InvalidOperationException: Collection was modified' inside
// JsonSerializerInternalWriter.SerializeDictionary on .NET Framework.
[Fact]
- public void SarifLogger_DisposeIsThreadSafeWhenSarifRewritingVisitorRunsConcurrently()
+ public async Task SarifLogger_DisposeIsThreadSafeWhenSarifRewritingVisitorRunsConcurrently()
{
const int iterations = 50;
const int ruleCount = 64;
@@ -1534,7 +1534,7 @@ public void SarifLogger_DisposeIsThreadSafeWhenSarifRewritingVisitorRunsConcurre
}
stop.Cancel();
- Task.WaitAll(mutatorTasks);
+ await Task.WhenAll(mutatorTasks);
yieldingWriter.Dispose();
if (caughtExceptions.Count > 0) { break; }
diff --git a/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj b/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj
index e9bb6e4e6..01fa3f492 100644
--- a/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj
+++ b/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj
@@ -17,9 +17,11 @@
+
+
diff --git a/src/WorkItems/ServiceProviderFactory.cs b/src/WorkItems/ServiceProviderFactory.cs
index faf2661d7..3086be869 100644
--- a/src/WorkItems/ServiceProviderFactory.cs
+++ b/src/WorkItems/ServiceProviderFactory.cs
@@ -50,7 +50,10 @@ public static void Initialize(ILogger customLogger)
{
if (!string.IsNullOrEmpty(config[LoggingApplicationInsightsInstrumentationKey]))
{
- builder.AddApplicationInsights(config[LoggingApplicationInsightsInstrumentationKey], options => options.FlushOnDispose = true);
+ string instrumentationKey = config[LoggingApplicationInsightsInstrumentationKey];
+ builder.AddApplicationInsights(
+ telemetry => telemetry.ConnectionString = $"InstrumentationKey={instrumentationKey}",
+ options => options.FlushOnDispose = true);
}
}
diff --git a/src/WorkItems/WorkItems.csproj b/src/WorkItems/WorkItems.csproj
index 6102b1977..81f260428 100644
--- a/src/WorkItems/WorkItems.csproj
+++ b/src/WorkItems/WorkItems.csproj
@@ -22,6 +22,9 @@
netstandard2.0
$(TargetFrameworks);net461
+
+ true
@@ -37,7 +40,9 @@
+
+
diff --git a/src/build.props b/src/build.props
index f1498ee6c..962eb6ab2 100644
--- a/src/build.props
+++ b/src/build.props
@@ -104,6 +104,14 @@
+
+
+
+
+
true
true