Skip to content

Commit

Permalink
style: remove unused nullable analysis hint
Browse files Browse the repository at this point in the history
  • Loading branch information
skwasjer committed Jan 2, 2023
1 parent e9049e9 commit 45d1bc6
Show file tree
Hide file tree
Showing 47 changed files with 54 additions and 139 deletions.
5 changes: 1 addition & 4 deletions src/MockHttp/Extensions/IRespondsExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable
using MockHttp.Http;
using MockHttp.Language;
using MockHttp.Language;
using MockHttp.Language.Flow;
using MockHttp.Language.Flow.Response;
using MockHttp.Responses;
Expand Down Expand Up @@ -140,4 +138,3 @@ public Task<HttpResponseMessage> ProduceResponseAsync(MockHttpRequestContext req
}
}
}
#nullable restore
8 changes: 4 additions & 4 deletions test/MockHttp.Testing/DelegateTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MockHttp;

public class DelegateTestCase : List<object>
public class DelegateTestCase : List<object?>
{
public string Name { get; }
public Delegate Delegate { get; }
Expand All @@ -15,7 +15,7 @@ private DelegateTestCase(Delegate @delegate)
Add(@delegate);
}

public IEnumerable<object[]> GetNullArgumentTestCases(bool withoutName = false)
public IEnumerable<object?[]> GetNullArgumentTestCases(bool withoutName = false)
{
const int paramOffset = 2;
MethodInfo methodInfo = Delegate.GetMethodInfo();
Expand All @@ -37,7 +37,7 @@ public IEnumerable<object[]> GetNullArgumentTestCases(bool withoutName = false)
}

// Set value for current case to null.
var testCase = new List<object>(this) { [i] = null! };
var testCase = new List<object?>(this) { [i] = null };

// Insert current parameter name.
testCase.Insert(paramOffset, parameter.Name!);
Expand All @@ -46,7 +46,7 @@ public IEnumerable<object[]> GetNullArgumentTestCases(bool withoutName = false)
}
}

public object[] WithoutName()
public object?[] WithoutName()
{
return this.Skip(1).ToArray();
}
Expand Down
3 changes: 1 addition & 2 deletions test/MockHttp.Tests/Extensions/IRespondsExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void Given_null_argument_when_executing_method_it_should_throw(params obj
NullArgumentTest.Execute(args);
}

public static IEnumerable<object[]> TestCases()
public static IEnumerable<object?[]> TestCases()
{
var streamMock = new Mock<Stream> { CallBase = true };
streamMock.SetReturnsDefault(true);
Expand Down Expand Up @@ -243,4 +243,3 @@ public Task<HttpResponseMessage> ProduceResponseAsync(MockHttpRequestContext req
}
}
}
#nullable restore
4 changes: 1 addition & 3 deletions test/MockHttp.Tests/Extensions/ListExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
namespace MockHttp.Extensions;
namespace MockHttp.Extensions;

public static class ListExtensionsTests
{
Expand Down Expand Up @@ -162,4 +161,3 @@ public void Given_that_list_is_empty_when_replacing_it_should_just_add()
}
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Collections.Specialized;
using System.Collections.Specialized;

namespace MockHttp.Extensions;

Expand Down Expand Up @@ -42,4 +41,3 @@ public void Given_nameValueCollection_when_getting_as_enumerable_should_succeed(
actual.Should().BeEquivalentTo(expectedKeyValuePairs);
}
}
#nullable restore
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public void Given_null_argument_when_executing_method_it_should_throw(params obj
NullArgumentTest.Execute(args);
}

public static IEnumerable<object[]> TestCases()
public static IEnumerable<object?[]> TestCases()
{
var streamMock = new Mock<Stream> { CallBase = true };
streamMock.SetReturnsDefault(true);
Expand Down
4 changes: 1 addition & 3 deletions test/MockHttp.Tests/Language/Flow/Response/ByteBodySpec.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Http;
using MockHttp.Specs;

Expand All @@ -22,4 +21,3 @@ protected override Task Should(HttpResponseMessage response)
.And.HaveContentAsync(Content);
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics;
using System.Diagnostics;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;
Expand Down Expand Up @@ -33,4 +32,3 @@ protected override async Task ShouldThrow(Func<Task> act)
_stopwatch.Elapsed.Should().BeGreaterThanOrEqualTo(TimeoutAfter ?? TimeSpan.Zero);
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
namespace MockHttp.Language.Flow.Response;
namespace MockHttp.Language.Flow.Response;

public class ClientTimeoutWithNullTimeSpanSpec : ClientTimeoutSpec
{
Expand All @@ -8,4 +7,3 @@ public ClientTimeoutWithNullTimeSpanSpec()
{
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -17,4 +16,3 @@ protected override Task ShouldThrow(Func<Task> act)
.WithParameterName("timeoutAfter");
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
namespace MockHttp.Language.Flow.Response;
namespace MockHttp.Language.Flow.Response;

public class ClientTimeoutWithZeroTimeSpanSpec : ClientTimeoutSpec
{
Expand All @@ -8,4 +7,3 @@ public ClientTimeoutWithZeroTimeSpanSpec()
{
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Text;
using System.Text;
using MockHttp.FluentAssertions;
using MockHttp.Http;
using MockHttp.Specs;
Expand All @@ -20,4 +19,3 @@ protected override Task Should(HttpResponseMessage response)
return Task.CompletedTask;
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Http;
using MockHttp.Specs;

Expand All @@ -19,4 +18,3 @@ protected override Task Should(HttpResponseMessage response)
return Task.CompletedTask;
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Http;
using MockHttp.Specs;

Expand All @@ -20,4 +19,3 @@ protected override Task Should(HttpResponseMessage response)
return Task.CompletedTask;
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -25,4 +24,3 @@ await act.Should()
_streamMock.Verify();
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Http;

namespace MockHttp.Language.Flow.Response;
Expand All @@ -19,4 +18,3 @@ protected override Task Should(HttpResponseMessage response)
.And.HaveContentAsync(Content);
}
}
#nullable restore
4 changes: 1 addition & 3 deletions test/MockHttp.Tests/Language/Flow/Response/HeaderSpec.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Globalization;
using System.Globalization;
using MockHttp.FluentAssertions;
using MockHttp.Specs;

Expand Down Expand Up @@ -46,4 +45,3 @@ protected override Task Should(HttpResponseMessage response)
return Task.CompletedTask;
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -17,4 +16,3 @@ protected override Task ShouldThrow(Func<Task> act)
.WithParameterName("name");
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -18,4 +17,3 @@ protected override Task ShouldThrow(Func<Task> act)
.WithMessage("At least one header must be specified.*");
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;
Expand All @@ -25,4 +24,3 @@ public override Task DisposeAsync()
return base.DisposeAsync();
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -17,4 +16,3 @@ protected override Task Should(HttpResponseMessage response)
return base.Should(response);
}
}
#nullable restore
4 changes: 1 addition & 3 deletions test/MockHttp.Tests/Language/Flow/Response/LatencySpec.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics;
using System.Diagnostics;
using System.Net;
using MockHttp.Specs;

Expand All @@ -23,4 +22,3 @@ protected override Task Should(HttpResponseMessage response)
return Task.CompletedTask;
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Text;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using MockHttp.FluentAssertions;
Expand Down Expand Up @@ -48,4 +47,3 @@ protected sealed override Task Should(HttpResponseMessage response)
.And.HaveContentAsync(Encoding.GetString(Encoding.GetPreamble()) + GetExpectedXml(), Encoding);
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Text;
using System.Text;
using System.Xml;

namespace MockHttp.Language.Flow.Response;
Expand All @@ -24,4 +23,3 @@ protected override string GetExpectedXml()
return $"<?xml version=\"1.0\" encoding=\"{Encoding.WebName}\"?><doc><title>Hello</title></doc>";
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Xml;
using System.Xml;

namespace MockHttp.Language.Flow.Response;

Expand All @@ -21,4 +20,3 @@ protected override string GetExpectedXml()
+ "</doc>";
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using System.Net.Http.Headers;
using System.Net.Http.Headers;
using System.Text;
using System.Xml;
using System.Xml.Linq;
Expand All @@ -17,7 +16,7 @@ public void Given_null_argument_when_executing_method_it_should_throw(params obj
NullArgumentTest.Execute(args);
}

public static IEnumerable<object[]> TestCases()
public static IEnumerable<object?[]> TestCases()
{
var responseBuilderImpl = new ResponseBuilder();
IResponseBuilder responseBuilder = Mock.Of<IResponseBuilder>();
Expand Down Expand Up @@ -134,6 +133,7 @@ public static IEnumerable<object[]> TestCases()
DelegateTestCase.Create(
ResponseBuilderExtensions.Latency,
responseBuilder,
// ReSharper disable once ConvertClosureToMethodGroup
() => NetworkLatency.FourG()
),
DelegateTestCase.Create(
Expand All @@ -147,4 +147,3 @@ public static IEnumerable<object[]> TestCases()
return testCases.SelectMany(tc => tc.GetNullArgumentTestCases());
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.FluentAssertions;
using MockHttp.FluentAssertions;
using MockHttp.Http;

namespace MockHttp.Language.Flow.Response;
Expand All @@ -19,4 +18,3 @@ protected override Task Should(HttpResponseMessage response)
.And.HaveContentAsync(new byte[] { 5, 4, 3, 2 });
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand Down Expand Up @@ -32,4 +31,3 @@ protected override Task ShouldThrow(Func<Task> act)
.WithParameterName("count");
}
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using MockHttp.Specs;
using MockHttp.Specs;

namespace MockHttp.Language.Flow.Response;

Expand Down Expand Up @@ -32,4 +31,3 @@ protected override Task ShouldThrow(Func<Task> act)
.WithParameterName("offset");
}
}
#nullable restore
Loading

0 comments on commit 45d1bc6

Please sign in to comment.