diff --git a/Directory.Packages.props b/Directory.Packages.props index f02dfec..97100d1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,7 +15,7 @@ - + diff --git a/tests/NetEvolve.Arguments.Analyser.Tests.Unit/AnalyzerVerifier.cs b/tests/NetEvolve.Arguments.Analyser.Tests.Unit/AnalyzerVerifier.cs index 6c6ec2e..46332a8 100644 --- a/tests/NetEvolve.Arguments.Analyser.Tests.Unit/AnalyzerVerifier.cs +++ b/tests/NetEvolve.Arguments.Analyser.Tests.Unit/AnalyzerVerifier.cs @@ -87,7 +87,12 @@ bool useLegacyReferences await codeFix.RegisterCodeFixesAsync(fixContext).ConfigureAwait(false); - var operations = await registeredAction!.GetOperationsAsync(CancellationToken.None).ConfigureAwait(false); + if (registeredAction is null) + { + throw new InvalidOperationException("No code fix action was registered."); + } + + var operations = await registeredAction.GetOperationsAsync(CancellationToken.None).ConfigureAwait(false); var applyChanges = operations.OfType().Single(); var newDocument = applyChanges.ChangedSolution.GetDocument(document.Id)!; var newRoot = await newDocument.GetSyntaxRootAsync().ConfigureAwait(false); diff --git a/tests/NetEvolve.Arguments.Tests.Unit/ObjectDisposedExceptionPolyfillsTests.cs b/tests/NetEvolve.Arguments.Tests.Unit/ObjectDisposedExceptionPolyfillsTests.cs index 0e47703..58a0ade 100644 --- a/tests/NetEvolve.Arguments.Tests.Unit/ObjectDisposedExceptionPolyfillsTests.cs +++ b/tests/NetEvolve.Arguments.Tests.Unit/ObjectDisposedExceptionPolyfillsTests.cs @@ -49,9 +49,9 @@ public async Task ThrowIf_WithType_WhenConditionIsFalse_DoesNotThrow() [Test] public async Task ThrowIf_WithNullInstance_WhenConditionIsTrue_ThrowsObjectDisposedException() { - object? instance = null; + object instance = null!; - void Act() => ObjectDisposedException.ThrowIf(true, instance!); + void Act() => ObjectDisposedException.ThrowIf(true, instance); var exception = Assert.Throws(Act); _ = await Assert.That(exception.ObjectName).IsEqualTo(string.Empty); @@ -60,9 +60,9 @@ public async Task ThrowIf_WithNullInstance_WhenConditionIsTrue_ThrowsObjectDispo [Test] public async Task ThrowIf_WithNullType_WhenConditionIsTrue_ThrowsObjectDisposedException() { - Type? type = null; + Type type = null!; - void Act() => ObjectDisposedException.ThrowIf(true, type!); + void Act() => ObjectDisposedException.ThrowIf(true, type); var exception = Assert.Throws(Act); _ = await Assert.That(exception.ObjectName).IsEqualTo(string.Empty);