chore: add NUnit Analyzers

This commit is contained in:
Kyle Ratti 2024-04-30 13:41:02 -04:00
parent 1ad8e46ab5
commit 12b2764a03
No known key found for this signature in database
GPG Key ID: 4D429B6287C68DD9
2 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" /> <PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> <PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2"> <PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View File

@ -32,6 +32,9 @@ public class NullableExtensionTests
[Test] [Test]
public void TestNullableReferenceOfValueAsMaybe() public void TestNullableReferenceOfValueAsMaybe()
{ {
// ReSharper disable once SuggestVarOrType_BuiltInTypes
// ReSharper disable once ConvertToConstant.Local
// ReSharper disable once VariableCanBeNotNullable
string? nullableString = "banana"; string? nullableString = "banana";
var result = nullableString.AsMaybe(); var result = nullableString.AsMaybe();