NO ConfigureAwait(false) + cleanup

This commit is contained in:
Stef Heyenrath
2025-08-31 12:39:51 +02:00
parent 0960d7cebd
commit 5b43a4f341
56 changed files with 351 additions and 616 deletions

View File

@@ -70,7 +70,7 @@ public class OwinResponseMapperTests
public async Task OwinResponseMapper_MapAsync_Null()
{
// Act
await _sut.MapAsync(null, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(null, _responseMock.Object);
}
[Theory]
@@ -85,7 +85,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_responseMock.VerifySet(r => r.StatusCode = expected, Times.Once);
@@ -106,7 +106,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_responseMock.VerifySet(r => r.StatusCode = expected, Times.Once);
@@ -122,7 +122,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_responseMock.VerifySet(r => r.StatusCode = It.IsAny<int>(), Times.Never);
@@ -142,7 +142,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_responseMock.VerifySet(r => r.StatusCode = expected, Times.Once);
@@ -158,7 +158,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_stream.Verify(s => s.WriteAsync(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<CancellationToken>()), Times.Never);
@@ -176,7 +176,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_stream.Verify(s => s.WriteAsync(new byte[] { 97, 98, 99, 100 }, 0, 4, It.IsAny<CancellationToken>()), Times.Once);
@@ -194,7 +194,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_stream.Verify(s => s.WriteAsync(bytes, 0, bytes.Length, It.IsAny<CancellationToken>()), Times.Once);
@@ -212,7 +212,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_stream.Verify(s => s.WriteAsync(new byte[] { 123, 34, 116, 34, 58, 34, 120, 34, 125 }, 0, 9, It.IsAny<CancellationToken>()), Times.Once);
@@ -228,7 +228,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
#if NET452
@@ -270,7 +270,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_stream.Verify(s => s.WriteAsync(new byte[0], 0, 0, It.IsAny<CancellationToken>()), Times.Once);
@@ -292,7 +292,7 @@ public class OwinResponseMapperTests
};
// Act
await _sut.MapAsync(responseMessage, _responseMock.Object).ConfigureAwait(false);
await _sut.MapAsync(responseMessage, _responseMock.Object);
// Assert
_responseMock.VerifySet(r => r.StatusCode = 100, Times.Once);

View File

@@ -100,7 +100,7 @@ public class WireMockMiddlewareTests
public async Task WireMockMiddleware_Invoke_NoMatch()
{
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert and Verify
_optionsMock.Verify(o => o.Logger.Warn(It.IsAny<string>(), It.IsAny<object[]>()), Times.Once);
@@ -118,7 +118,7 @@ public class WireMockMiddlewareTests
_optionsMock.Setup(o => o.SaveUnmatchedRequests).Returns(true);
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert
_optionsMock.Verify(o => o.Logger.Warn(It.IsAny<string>(), It.IsAny<object[]>()), Times.Once);
@@ -145,7 +145,7 @@ public class WireMockMiddlewareTests
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns((result, result));
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert and Verify
_optionsMock.Verify(o => o.Logger.Error(It.IsAny<string>(), It.IsAny<object[]>()), Times.Once);
@@ -168,7 +168,7 @@ public class WireMockMiddlewareTests
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns((result, result));
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert and Verify
_optionsMock.Verify(o => o.Logger.Error(It.IsAny<string>(), It.IsAny<object[]>()), Times.Once);
@@ -184,7 +184,7 @@ public class WireMockMiddlewareTests
_optionsMock.SetupGet(o => o.RequestLogExpirationDuration).Returns(1);
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
}
[Fact]
@@ -228,7 +228,7 @@ public class WireMockMiddlewareTests
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns((result, result));
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert and Verify
fileSystemHandlerMock.Verify(f => f.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
@@ -282,7 +282,7 @@ public class WireMockMiddlewareTests
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns((result, result));
// Act
await _sut.Invoke(_contextMock.Object).ConfigureAwait(false);
await _sut.Invoke(_contextMock.Object);
// Assert and Verify
fileSystemHandlerMock.Verify(f => f.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Once);