diff --git a/Rebus.Tests.Contracts/Activation/ContainerTests.cs b/Rebus.Tests.Contracts/Activation/ContainerTests.cs index e940c386f..b6d64726c 100644 --- a/Rebus.Tests.Contracts/Activation/ContainerTests.cs +++ b/Rebus.Tests.Contracts/Activation/ContainerTests.cs @@ -121,10 +121,10 @@ public void MultipleRegistrationsException() containerAdapter.SetBus(new FakeBus()); - var exception = Assert.Throws(() => + var exception = Assert.Throws((Action)(() => { containerAdapter.SetBus(new FakeBus()); - }, "Expected that the second call to SetBus on the container adapter with another bus instance would throw an exception"); + }), "Expected that the second call to SetBus on the container adapter with another bus instance would throw an exception"); Console.WriteLine(exception); } diff --git a/Rebus.Tests.Contracts/DataBus/GeneralDataBusStorageTests.cs b/Rebus.Tests.Contracts/DataBus/GeneralDataBusStorageTests.cs index 006f2b809..9d642b1c0 100644 --- a/Rebus.Tests.Contracts/DataBus/GeneralDataBusStorageTests.cs +++ b/Rebus.Tests.Contracts/DataBus/GeneralDataBusStorageTests.cs @@ -120,7 +120,7 @@ public async Task CanDeleteAttachment() await _management.Delete(knownId); - var exception = Assert.ThrowsAsync(() => _storage.Read(knownId), + var exception = Assert.ThrowsAsync(new Func(() => _storage.Read(knownId)), $"Expected an ArgumentException, because the attachment with ID {knownId} was deleted"); Console.WriteLine(exception); @@ -162,10 +162,10 @@ public async Task UpdatesTimeOfLastRead() [Test] public void ThrowsWhenLoadingNonExistentId() { - var exception = Assert.ThrowsAsync(async () => + var exception = Assert.ThrowsAsync(new Func(async () => { var result = await _storage.Read(Guid.NewGuid().ToString()); - }); + })); Console.WriteLine(exception); diff --git a/Rebus.Tests.Contracts/Errors/ExceptionInfoTests.cs b/Rebus.Tests.Contracts/Errors/ExceptionInfoTests.cs index 3e192f87f..76be9ac48 100644 --- a/Rebus.Tests.Contracts/Errors/ExceptionInfoTests.cs +++ b/Rebus.Tests.Contracts/Errors/ExceptionInfoTests.cs @@ -19,7 +19,7 @@ protected override void SetUp() [Test] public async Task ThrowsOnNullException() { - Assert.That(() => _factory.CreateInfo(null), Throws.TypeOf()); + Assert.Throws((Action)(() => _factory.CreateInfo(null))); } [Test] @@ -61,7 +61,7 @@ public async Task GetFullErrorDescriptionIsNotEmpty() public async Task ConvertToThrowsOnUnexpectedInfoType() { var info = _factory.CreateInfo(new Exception("a")); - Assert.That(() => info.ConvertTo(), Throws.TypeOf()); + Assert.Throws((Action)(() => info.ConvertTo())); } record UnexpectedExceptionInfo : ExceptionInfo diff --git a/Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj b/Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj index 4a64bb216..dacb2021e 100644 --- a/Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj +++ b/Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj @@ -23,7 +23,7 @@ - - + + \ No newline at end of file diff --git a/Rebus.Tests.Contracts/Sagas/BasicLoadAndSaveAndFindOperations.cs b/Rebus.Tests.Contracts/Sagas/BasicLoadAndSaveAndFindOperations.cs index ec1923646..5fba29617 100644 --- a/Rebus.Tests.Contracts/Sagas/BasicLoadAndSaveAndFindOperations.cs +++ b/Rebus.Tests.Contracts/Sagas/BasicLoadAndSaveAndFindOperations.cs @@ -109,7 +109,7 @@ class DataWithCustomId : SagaData { } [Test] public void ChecksRevisionOnFirstInsert() { - var ex = Assert.Throws(() => + var ex = Assert.Throws((Action)(() => { _sagaStorage .Insert(new JustSomeSagaData @@ -118,7 +118,7 @@ public void ChecksRevisionOnFirstInsert() Revision = 1 }, _noCorrelationProperties) .Wait(); - }); + })); var invalidOperationException = ex.InnerExceptions.OfType().Single(); Console.WriteLine(ex); @@ -173,10 +173,10 @@ public async Task ThrowsIfIdHasNotBeenSet() { var sagaDataWithDefaultId = new AnotherSagaData { Id = Guid.Empty }; - var aggregateException = Assert.Throws(() => + var aggregateException = Assert.Throws((Action)(() => { _sagaStorage.Insert(sagaDataWithDefaultId, _noCorrelationProperties).Wait(); - }); + })); var baseException = aggregateException.GetBaseException(); diff --git a/Rebus.Tests.Contracts/Sagas/ConcurrencyHandling.cs b/Rebus.Tests.Contracts/Sagas/ConcurrencyHandling.cs index 78c0313e4..e580abb60 100644 --- a/Rebus.Tests.Contracts/Sagas/ConcurrencyHandling.cs +++ b/Rebus.Tests.Contracts/Sagas/ConcurrencyHandling.cs @@ -44,7 +44,7 @@ public async Task ThrowsWhenRevisionDoesNotMatchExpected() await _sagaStorage.Update(loadedData1, _noCorrelationProperties); - var aggregateException = Assert.Throws(() => _sagaStorage.Update(loadedData2, _noCorrelationProperties).Wait()); + var aggregateException = Assert.Throws((Action)(() => _sagaStorage.Update(loadedData2, _noCorrelationProperties).Wait())); var baseException = aggregateException.GetBaseException(); diff --git a/Rebus.Tests.Contracts/Transports/BasicSendReceive.cs b/Rebus.Tests.Contracts/Transports/BasicSendReceive.cs index 3516ead2e..5513afee9 100644 --- a/Rebus.Tests.Contracts/Transports/BasicSendReceive.cs +++ b/Rebus.Tests.Contracts/Transports/BasicSendReceive.cs @@ -178,7 +178,7 @@ await WithContext(async ctx => { var receivedMessages = allMessages.OrderBy(s => s).ToArray(); - Assert.That(receivedMessages.Count, Is.EqualTo(2), "Two messages were sent, so we expected two messages to be received"); + Assert.That(receivedMessages.Length, Is.EqualTo(2), "Two messages were sent, so we expected two messages to be received"); Assert.That(receivedMessages, Is.EqualTo(new[] { "hej1", "hej2" }), $"Expected that the messages 'hej1' and 'hej2' would have been received, but instead we got this: {string.Join(", ", receivedMessages)}"); diff --git a/Rebus.Tests/Rebus.Tests.csproj b/Rebus.Tests/Rebus.Tests.csproj index 55eee70d6..073eb3507 100644 --- a/Rebus.Tests/Rebus.Tests.csproj +++ b/Rebus.Tests/Rebus.Tests.csproj @@ -8,9 +8,9 @@ - + - + diff --git a/Rebus.Tests/Routing/TestTypeBasedRouter.cs b/Rebus.Tests/Routing/TestTypeBasedRouter.cs index bf83a1113..3a6d954f5 100644 --- a/Rebus.Tests/Routing/TestTypeBasedRouter.cs +++ b/Rebus.Tests/Routing/TestTypeBasedRouter.cs @@ -25,10 +25,10 @@ protected override void SetUp() [Test] public void ThrowsByDefaultWhenRoutingUnmappedTopic() { - var aggregateException = Assert.Throws(() => + var aggregateException = Assert.Throws((Action)(() => { _router.GetDestinationAddress(new Message(NoHeaders, "STRING BODY")).Wait(); - }); + })); var baseException = aggregateException.GetBaseException(); @@ -97,14 +97,14 @@ public void WorksWithAssemblyRouteMappingAndDerivedClasses() Assert.That(GetDestinationForBody(new TestNamespaceRouting.SubNamespace.AssemblyMessageSubNamespace()), Is.EqualTo("AssemblyDestination")); // These ones should NOT be mapped - Assert.Throws(() => + Assert.Throws((Action)(() => { GetDestinationForBody(new TestNamespaceRouting.AssemblyMessageTwo()); - }); - Assert.Throws(() => + })); + Assert.Throws((Action)(() => { GetDestinationForBody(new OtherNamespaceRouting.AssemblyMessageOtherNamespace()); - }); + })); } [Test] @@ -118,10 +118,10 @@ public void WorksWithNamespaceRouteMapping() Assert.That(GetDestinationForBody(new TestNamespaceRouting.SubNamespace.AssemblyMessageSubNamespace()), Is.EqualTo("AssemblyDestination")); // This one should NOT be mapped - Assert.Throws(() => + Assert.Throws((Action)(() => { GetDestinationForBody(new OtherNamespaceRouting.AssemblyMessageOtherNamespace()); - }); + })); } [Test] diff --git a/Rebus.Tests/Serialization/TestJsonSerializer.cs b/Rebus.Tests/Serialization/TestJsonSerializer.cs index 508bd6f8c..56c457107 100644 --- a/Rebus.Tests/Serialization/TestJsonSerializer.cs +++ b/Rebus.Tests/Serialization/TestJsonSerializer.cs @@ -103,13 +103,13 @@ public void CheckErrorWhenContentTypeHeaderIsMissing() var headersWithEmptyContentType = new Dictionary { [Headers.ContentType] = null }; var headersWithoutContentType = new Dictionary(); - var ex1 = Assert.ThrowsAsync(() => _serializer.Deserialize( - new TransportMessage(headersWithoutContentType, jsonBody))); + var ex1 = Assert.ThrowsAsync(new Func(() => _serializer.Deserialize( + new TransportMessage(headersWithoutContentType, jsonBody)))); Console.WriteLine(ex1); - var ex2 = Assert.ThrowsAsync(() => _serializer.Deserialize( - new TransportMessage(headersWithEmptyContentType, jsonBody))); + var ex2 = Assert.ThrowsAsync(new Func(() => _serializer.Deserialize( + new TransportMessage(headersWithEmptyContentType, jsonBody)))); Console.WriteLine(ex2); } diff --git a/Rebus.Tests/Serialization/TestSystemTextJsonSerializer.cs b/Rebus.Tests/Serialization/TestSystemTextJsonSerializer.cs index c8c2c3113..1ccc5de72 100644 --- a/Rebus.Tests/Serialization/TestSystemTextJsonSerializer.cs +++ b/Rebus.Tests/Serialization/TestSystemTextJsonSerializer.cs @@ -104,13 +104,13 @@ public void CheckErrorWhenContentTypeHeaderIsMissing() var headersWithEmptyContentType = new Dictionary { [Headers.ContentType] = null }; var headersWithoutContentType = new Dictionary(); - var ex1 = Assert.ThrowsAsync(() => _serializer.Deserialize( - new TransportMessage(headersWithoutContentType, jsonBody))); + var ex1 = Assert.ThrowsAsync(new Func(() => _serializer.Deserialize( + new TransportMessage(headersWithoutContentType, jsonBody)))); Console.WriteLine(ex1); - var ex2 = Assert.ThrowsAsync(() => _serializer.Deserialize( - new TransportMessage(headersWithEmptyContentType, jsonBody))); + var ex2 = Assert.ThrowsAsync(new Func(() => _serializer.Deserialize( + new TransportMessage(headersWithEmptyContentType, jsonBody)))); Console.WriteLine(ex2); } diff --git a/Rebus/Rebus.csproj b/Rebus/Rebus.csproj index 29b971d0c..d19b64c29 100644 --- a/Rebus/Rebus.csproj +++ b/Rebus/Rebus.csproj @@ -24,13 +24,13 @@ HASGUIDV7 - + - +