mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 00:38:28 +02:00
Add unit tests for HttpClient with WebProxy (#1010)
* Add test for SSL / Https * Add unit tests for HttpClient with WebProxy * cert.pem * x * skip * example google * revert * host tests * sonar
This commit is contained in:
60
test/WireMock.Net.Tests/Owin/HostUrlOptionsTests.cs
Normal file
60
test/WireMock.Net.Tests/Owin/HostUrlOptionsTests.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using WireMock.Owin;
|
||||
using WireMock.Types;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Owin;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class HostUrlOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void GetDetails_WithNoUrlsAndHttpScheme_ShouldReturnCorrectDetails()
|
||||
{
|
||||
// Arrange
|
||||
var options = new HostUrlOptions
|
||||
{
|
||||
HostingScheme = HostingScheme.Http,
|
||||
Port = 8080
|
||||
};
|
||||
|
||||
// Act
|
||||
var details = options.GetDetails();
|
||||
|
||||
// Assert
|
||||
details.Should().HaveCount(1);
|
||||
var detail = details.Single();
|
||||
detail.Should().Match<HostUrlDetails>(d =>
|
||||
d.Scheme == "http" &&
|
||||
d.Host == "localhost" &&
|
||||
d.Port == 8080 &&
|
||||
d.IsHttps == false
|
||||
);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetDetails_WithNoUrlsAndHttpsScheme_ShouldReturnCorrectDetails()
|
||||
{
|
||||
// Arrange
|
||||
var options = new HostUrlOptions
|
||||
{
|
||||
HostingScheme = HostingScheme.Https,
|
||||
Port = 8081
|
||||
};
|
||||
|
||||
// Act
|
||||
var details = options.GetDetails();
|
||||
|
||||
// Assert
|
||||
details.Should().HaveCount(1);
|
||||
var detail = details.Single();
|
||||
detail.Should().Match<HostUrlDetails>(d =>
|
||||
d.Scheme == "https" &&
|
||||
d.Host == "localhost" &&
|
||||
d.Port == 8081 &&
|
||||
d.IsHttps == true
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user