Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump RichardSzalay.MockHttp from 6.0.0 to 7.0.0 #477

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BackendAccessTest/BackendAccessTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="21.0.22" />
</ItemGroup>

Expand Down
7 changes: 5 additions & 2 deletions BackendAccessTest/BackendServices/UserWebApiServicesUt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,18 @@
var applicationConfiguration = Substitute.For<IApplicationConfiguration>();
applicationConfiguration[IApplicationConfiguration.BackendBaseUrl].Returns("invalidUrl");
var httpClientFactory = Substitute.For<IHttpClientFactory>();
var mockHttpMessageHandler = new MockHttpMessageHandler();
httpClientFactory.CreateClient(Arg.Any<ProgressMessageHandler>())
.Returns(new HttpClient(new MockHttpMessageHandler()));
.Returns(new HttpClient(mockHttpMessageHandler));

mockHttpMessageHandler.When("*").Throw(new HttpRequestException("Invalid URL", new SocketException()));

var userWebApiServices =
CreateTestableUserWebApiServices(applicationConfiguration, httpClientFactory: httpClientFactory);

var ex = Assert.ThrowsAsync<BackendInvalidUrlException>(async () =>
await userWebApiServices.GetUserTokenAsync("username", "password"));
Assert.That(ex!.Message, Is.EqualTo("There is no AdLer Backend at the given URL."));
Assert.That(ex!.Message, Is.EqualTo("The URL is not reachable. Either the URL does not exist or there is no internet connection."));
}

[Test]
Expand Down Expand Up @@ -291,7 +294,7 @@

var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StringContent(responseContent);
mockedHttp

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (ubuntu-22.04)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (macos-latest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (ubuntu-20.04)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / build (BackendAccessTest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / build (BackendAccessTest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 297 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (windows-latest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'
.When("*")
.Respond(response);
var mockHttpClientFactory = Substitute.For<IHttpClientFactory>();
Expand Down Expand Up @@ -366,7 +369,7 @@
var response = new HttpResponseMessage(HttpStatusCode.Conflict);

response.Content = new StringContent("invalid response");
mockedHttp

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (ubuntu-22.04)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (macos-latest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (ubuntu-20.04)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / build (BackendAccessTest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / build (BackendAccessTest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'

Check warning on line 372 in BackendAccessTest/BackendServices/UserWebApiServicesUt.cs

View workflow job for this annotation

GitHub Actions / test-platforms (windows-latest)

'MockedRequestExtensions.Respond(MockedRequest, HttpResponseMessage)' is obsolete: 'Using this overload is not recommended. Instead, use Respond(req => new HttpResponseMessage(...))'
.When("*")
.Respond(response);
var mockHttpClientFactory = Substitute.For<IHttpClientFactory>();
Expand Down
Loading