Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Rebus.Tests.Contracts/Activation/ContainerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public void MultipleRegistrationsException()

containerAdapter.SetBus(new FakeBus());

var exception = Assert.Throws<InvalidOperationException>(() =>
var exception = Assert.Throws<InvalidOperationException>((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);
}
Expand Down
6 changes: 3 additions & 3 deletions Rebus.Tests.Contracts/DataBus/GeneralDataBusStorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public async Task CanDeleteAttachment()

await _management.Delete(knownId);

var exception = Assert.ThrowsAsync<ArgumentException>(() => _storage.Read(knownId),
var exception = Assert.ThrowsAsync<ArgumentException>(new Func<System.Threading.Tasks.Task>(() => _storage.Read(knownId)),
$"Expected an ArgumentException, because the attachment with ID {knownId} was deleted");

Console.WriteLine(exception);
Expand Down Expand Up @@ -162,10 +162,10 @@ public async Task UpdatesTimeOfLastRead()
[Test]
public void ThrowsWhenLoadingNonExistentId()
{
var exception = Assert.ThrowsAsync<ArgumentException>(async () =>
var exception = Assert.ThrowsAsync<ArgumentException>(new Func<System.Threading.Tasks.Task>(async () =>
{
var result = await _storage.Read(Guid.NewGuid().ToString());
});
}));

Console.WriteLine(exception);

Expand Down
4 changes: 2 additions & 2 deletions Rebus.Tests.Contracts/Errors/ExceptionInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override void SetUp()
[Test]
public async Task ThrowsOnNullException()
{
Assert.That(() => _factory.CreateInfo(null), Throws.TypeOf<ArgumentNullException>());
Assert.Throws<ArgumentNullException>((Action)(() => _factory.CreateInfo(null)));
}

[Test]
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task GetFullErrorDescriptionIsNotEmpty()
public async Task ConvertToThrowsOnUnexpectedInfoType()
{
var info = _factory.CreateInfo(new Exception("a"));
Assert.That(() => info.ConvertTo<UnexpectedExceptionInfo>(), Throws.TypeOf<ArgumentException>());
Assert.Throws<ArgumentException>((Action)(() => info.ConvertTo<UnexpectedExceptionInfo>()));
}

record UnexpectedExceptionInfo : ExceptionInfo
Expand Down
4 changes: 2 additions & 2 deletions Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NUnit" Version="4.5.1" />
<PackageReference Include="Rebus" Version="8.9.0" />
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="Rebus" Version="8.9.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DataWithCustomId : SagaData { }
[Test]
public void ChecksRevisionOnFirstInsert()
{
var ex = Assert.Throws<AggregateException>(() =>
var ex = Assert.Throws<AggregateException>((Action)(() =>
{
_sagaStorage
.Insert(new JustSomeSagaData
Expand All @@ -118,7 +118,7 @@ public void ChecksRevisionOnFirstInsert()
Revision = 1
}, _noCorrelationProperties)
.Wait();
});
}));

var invalidOperationException = ex.InnerExceptions.OfType<InvalidOperationException>().Single();
Console.WriteLine(ex);
Expand Down Expand Up @@ -173,10 +173,10 @@ public async Task ThrowsIfIdHasNotBeenSet()
{
var sagaDataWithDefaultId = new AnotherSagaData { Id = Guid.Empty };

var aggregateException = Assert.Throws<AggregateException>(() =>
var aggregateException = Assert.Throws<AggregateException>((Action)(() =>
{
_sagaStorage.Insert(sagaDataWithDefaultId, _noCorrelationProperties).Wait();
});
}));

var baseException = aggregateException.GetBaseException();

Expand Down
2 changes: 1 addition & 1 deletion Rebus.Tests.Contracts/Sagas/ConcurrencyHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task ThrowsWhenRevisionDoesNotMatchExpected()

await _sagaStorage.Update(loadedData1, _noCorrelationProperties);

var aggregateException = Assert.Throws<AggregateException>(() => _sagaStorage.Update(loadedData2, _noCorrelationProperties).Wait());
var aggregateException = Assert.Throws<AggregateException>((Action)(() => _sagaStorage.Update(loadedData2, _noCorrelationProperties).Wait()));

var baseException = aggregateException.GetBaseException();

Expand Down
2 changes: 1 addition & 1 deletion Rebus.Tests.Contracts/Transports/BasicSendReceive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)}");
Expand Down
4 changes: 2 additions & 2 deletions Rebus.Tests/Rebus.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<ProjectReference Include="..\Rebus\Rebus.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NUnit" Version="4.5.1" />
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="Rebus.Tests.Contracts" Version="8.9.1" />
</ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions Rebus.Tests/Routing/TestTypeBasedRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ protected override void SetUp()
[Test]
public void ThrowsByDefaultWhenRoutingUnmappedTopic()
{
var aggregateException = Assert.Throws<AggregateException>(() =>
var aggregateException = Assert.Throws<AggregateException>((Action)(() =>
{
_router.GetDestinationAddress(new Message(NoHeaders, "STRING BODY")).Wait();
});
}));

var baseException = aggregateException.GetBaseException();

Expand Down Expand Up @@ -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<AggregateException>(() =>
Assert.Throws<AggregateException>((Action)(() =>
{
GetDestinationForBody(new TestNamespaceRouting.AssemblyMessageTwo());
});
Assert.Throws<AggregateException>(() =>
}));
Assert.Throws<AggregateException>((Action)(() =>
{
GetDestinationForBody(new OtherNamespaceRouting.AssemblyMessageOtherNamespace());
});
}));
}

[Test]
Expand All @@ -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<AggregateException>(() =>
Assert.Throws<AggregateException>((Action)(() =>
{
GetDestinationForBody(new OtherNamespaceRouting.AssemblyMessageOtherNamespace());
});
}));
}

[Test]
Expand Down
8 changes: 4 additions & 4 deletions Rebus.Tests/Serialization/TestJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public void CheckErrorWhenContentTypeHeaderIsMissing()
var headersWithEmptyContentType = new Dictionary<string, string> { [Headers.ContentType] = null };
var headersWithoutContentType = new Dictionary<string, string>();

var ex1 = Assert.ThrowsAsync<KeyNotFoundException>(() => _serializer.Deserialize(
new TransportMessage(headersWithoutContentType, jsonBody)));
var ex1 = Assert.ThrowsAsync<KeyNotFoundException>(new Func<System.Threading.Tasks.Task>(() => _serializer.Deserialize(
new TransportMessage(headersWithoutContentType, jsonBody))));

Console.WriteLine(ex1);

var ex2 = Assert.ThrowsAsync<FormatException>(() => _serializer.Deserialize(
new TransportMessage(headersWithEmptyContentType, jsonBody)));
var ex2 = Assert.ThrowsAsync<FormatException>(new Func<System.Threading.Tasks.Task>(() => _serializer.Deserialize(
new TransportMessage(headersWithEmptyContentType, jsonBody))));

Console.WriteLine(ex2);
}
Expand Down
8 changes: 4 additions & 4 deletions Rebus.Tests/Serialization/TestSystemTextJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ public void CheckErrorWhenContentTypeHeaderIsMissing()
var headersWithEmptyContentType = new Dictionary<string, string> { [Headers.ContentType] = null };
var headersWithoutContentType = new Dictionary<string, string>();

var ex1 = Assert.ThrowsAsync<KeyNotFoundException>(() => _serializer.Deserialize(
new TransportMessage(headersWithoutContentType, jsonBody)));
var ex1 = Assert.ThrowsAsync<KeyNotFoundException>(new Func<System.Threading.Tasks.Task>(() => _serializer.Deserialize(
new TransportMessage(headersWithoutContentType, jsonBody))));

Console.WriteLine(ex1);

var ex2 = Assert.ThrowsAsync<FormatException>(() => _serializer.Deserialize(
new TransportMessage(headersWithEmptyContentType, jsonBody)));
var ex2 = Assert.ThrowsAsync<FormatException>(new Func<System.Threading.Tasks.Task>(() => _serializer.Deserialize(
new TransportMessage(headersWithEmptyContentType, jsonBody))));

Console.WriteLine(ex2);
}
Expand Down
4 changes: 2 additions & 2 deletions Rebus/Rebus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<DefineConstants>HASGUIDV7</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(EnableSourceLink)' != 'false'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.202" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.301" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="system.text.json" Version="10.0.6" />
<PackageReference Include="system.text.json" Version="10.0.10" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
Expand Down