-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
8 changed files
with
202 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIB9TCCAZugAwIBAgIUYH7UM/DAXzosxsT+ea2jdYvhqqMwCgYIKoZIzj0EAwIw | ||
UDELMAkGA1UEBhMCTkwxEzARBgNVBAgMClNvbWUtU3RhdGUxFTATBgNVBAoMDFdp | ||
cmVNb2NrLk5ldDEVMBMGA1UEAwwMV2lyZU1vY2suTmV0MB4XDTIyMDgxMTE2MjE0 | ||
NFoXDTMyMDYxOTE2MjE0NFowUDELMAkGA1UEBhMCTkwxEzARBgNVBAgMClNvbWUt | ||
U3RhdGUxFTATBgNVBAoMDFdpcmVNb2NrLk5ldDEVMBMGA1UEAwwMV2lyZU1vY2su | ||
TmV0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE39VoI268uDuIeKmRzr9e9jgM | ||
SGeuJTvTG7+cSXmeDymrVgIGXQgmqKA8TDXpJNrRhWMd/fpsnWu1JwJUjBmspaNT | ||
MFEwHQYDVR0OBBYEFILL8V+fAtMnccWKGAdkx2Dh/v/TMB8GA1UdIwQYMBaAFILL | ||
8V+fAtMnccWKGAdkx2Dh/v/TMA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwID | ||
SAAwRQIgKDLAG8OWK6GF5HV4kmWz3kp2V3yVsNK2V9Lw3dSE+YsCIQCK1EEBvuqc | ||
0ncZV4ETVnOY23PWFOMk1VwN2aoTi5n++Q== | ||
-----END CERTIFICATE----- |