mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 08:18:26 +02:00
Fix some SonarCloud issues in UnitTests (#610)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using NFluent;
|
using NFluent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using WireMock.Http;
|
using WireMock.Http;
|
||||||
using WireMock.Models;
|
using WireMock.Models;
|
||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
@@ -28,7 +29,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void HttpRequestMessageHelper_Create_Bytes()
|
public async Task HttpRequestMessageHelper_Create_Bytes()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var body = new BodyData
|
var body = new BodyData
|
||||||
@@ -46,7 +47,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void HttpRequestMessageHelper_Create_Json()
|
public async Task HttpRequestMessageHelper_Create_Json()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var body = new BodyData
|
var body = new BodyData
|
||||||
@@ -64,7 +65,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void HttpRequestMessageHelper_Create_Json_With_ContentType_ApplicationJson()
|
public async Task HttpRequestMessageHelper_Create_Json_With_ContentType_ApplicationJson()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var headers = new Dictionary<string, string[]> { { "Content-Type", new[] { "application/json" } } };
|
var headers = new Dictionary<string, string[]> { { "Content-Type", new[] { "application/json" } } };
|
||||||
@@ -84,7 +85,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void HttpRequestMessageHelper_Create_Json_With_ContentType_ApplicationJson_UTF8()
|
public async Task HttpRequestMessageHelper_Create_Json_With_ContentType_ApplicationJson_UTF8()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var headers = new Dictionary<string, string[]> { { "Content-Type", new[] { "application/json; charset=utf-8" } } };
|
var headers = new Dictionary<string, string[]> { { "Content-Type", new[] { "application/json; charset=utf-8" } } };
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace WireMock.Net.Tests
|
|||||||
public class ObservableLogEntriesTest
|
public class ObservableLogEntriesTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockServer_LogEntriesChanged_WithException_Should_LogError()
|
public async Task WireMockServer_LogEntriesChanged_WithException_Should_LogError()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
string path = $"/log_{Guid.NewGuid()}";
|
string path = $"/log_{Guid.NewGuid()}";
|
||||||
@@ -48,7 +48,7 @@ namespace WireMock.Net.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockServer_LogEntriesChanged()
|
public async Task WireMockServer_LogEntriesChanged()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
string path = $"/log_{Guid.NewGuid()}";
|
string path = $"/log_{Guid.NewGuid()}";
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_NoMatch()
|
public async Task WireMockMiddleware_Invoke_NoMatch()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
await _sut.Invoke(_contextMock.Object);
|
await _sut.Invoke(_contextMock.Object);
|
||||||
@@ -90,7 +90,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_IsAdminInterface_EmptyHeaders_401()
|
public async Task WireMockMiddleware_Invoke_IsAdminInterface_EmptyHeaders_401()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
||||||
@@ -113,7 +113,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_IsAdminInterface_MissingHeader_401()
|
public async Task WireMockMiddleware_Invoke_IsAdminInterface_MissingHeader_401()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]> { { "h", new[] { "x" } } });
|
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]> { { "h", new[] { "x" } } });
|
||||||
@@ -136,7 +136,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_RequestLogExpirationDurationIsDefined()
|
public async Task WireMockMiddleware_Invoke_RequestLogExpirationDurationIsDefined()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
_optionsMock.SetupGet(o => o.RequestLogExpirationDuration).Returns(1);
|
_optionsMock.SetupGet(o => o.RequestLogExpirationDuration).Returns(1);
|
||||||
@@ -146,7 +146,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_Mapping_Has_ProxyAndRecordSettings_And_SaveMapping_Is_True()
|
public async Task WireMockMiddleware_Invoke_Mapping_Has_ProxyAndRecordSettings_And_SaveMapping_Is_True()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
||||||
@@ -195,7 +195,7 @@ namespace WireMock.Net.Tests.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockMiddleware_Invoke_Mapping_Has_ProxyAndRecordSettings_And_SaveMapping_Is_False_But_WireMockServerSettings_SaveMapping_Is_True()
|
public async Task WireMockMiddleware_Invoke_Mapping_Has_ProxyAndRecordSettings_And_SaveMapping_Is_False_But_WireMockServerSettings_SaveMapping_Is_True()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1", null, new Dictionary<string, string[]>());
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ namespace WireMock.Net.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void WireMockServer_Admin_DeleteMappings()
|
public async Task WireMockServer_Admin_DeleteMappings()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var server = WireMockServer.Start(new WireMockServerSettings
|
var server = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
|||||||
Reference in New Issue
Block a user