Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ArieGato committed Feb 1, 2024
1 parent 22fc399 commit 6b0a7e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,8 @@

namespace Serilog.Sinks.RabbitMQ.Tests.Integration
{
public class RabbitMQConnectionFactoryTests : IClassFixture<RabbitMQFixture>
public class RabbitMQConnectionFactoryTests
{
private readonly RabbitMQFixture _fixture;

public RabbitMQConnectionFactoryTests(RabbitMQFixture fixture)
{
_fixture = fixture;
}

[Fact]
public void GetConnection_ShouldReturnOpenConnection()
{
Expand All @@ -48,4 +41,4 @@ public void GetConnection_ShouldReturnNull_WhenBrokerCannotBeReached()
act.Should().ThrowExactly<BrokerUnreachableException>();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public async Task AutoCreateExchange_WhenTrue_ThenShouldCreateExchange()

var rabbitMQClient = new RabbitMQClient(rabbitMQClientConfiguration);
rabbitMQClient.Publish("a message");

//// wait for message sent
//await Task.Delay(1000);

Expand All @@ -124,7 +124,6 @@ public async Task AutoCreateExchange_WhenTrue_ThenShouldCreateExchange()
}
}

#if NET8_0_OR_GREATER
/// <summary>
/// Consumer should receive a message after calling Publish.
/// </summary>
Expand All @@ -137,9 +136,9 @@ public async Task Publish_ParallelMessages_AllMessagesArePublished()
var watch = System.Diagnostics.Stopwatch.StartNew();
var message = Guid.NewGuid().ToString();

var parallelOptions = new ParallelOptions(){ MaxDegreeOfParallelism = 10 };
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = 10 };

await Parallel.ForAsync(0, 10, parallelOptions, async (_, _) =>
Parallel.For(0, 10, parallelOptions, (_, _) =>
{
for (var i = 0; i < 1000; i++)
{
Expand All @@ -149,6 +148,5 @@ await Parallel.ForAsync(0, 10, parallelOptions, async (_, _) =>

watch.Stop();
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Serilog.Sinks.RabbitMQ.Tests.RabbitMQ
public class RabbitMQClientTests
{
[Fact]
public async Task PublishAsync_ShouldCreateAndReturnChannelToPool()
public void Publish_ShouldCreateAndReturnChannelToPool()
{
// Arrange
var rabbitMQClientConfiguration = new RabbitMQClientConfiguration()
Expand Down Expand Up @@ -81,7 +81,7 @@ public void Close_ShouldThrowAggregateException_WhenExceptionsOccur()
RouteKey = "some-route-key"
};
var rabbitMQConnectionFactory = Substitute.For<IRabbitMQConnectionFactory>();
rabbitMQConnectionFactory.When(x => x.Close()).Do(x => throw new InvalidOperationException("some-exception"));
rabbitMQConnectionFactory.When(x => x.Close()).Do(_ => throw new InvalidOperationException("some-exception"));

var rabbitMQChannelObjectPoolPolicy = Substitute.For<IPooledObjectPolicy<IRabbitMQChannel>>();

Expand All @@ -100,7 +100,7 @@ public void Close_ShouldThrowAggregateException_WhenExceptionsOccur()
}

[Fact]
public async Task Dispose_ShouldDisposeConnectionAndChannel()
public void Dispose_ShouldDisposeConnectionAndChannel()
{
// Arrange
var rabbitMQClientConfiguration = new RabbitMQClientConfiguration()
Expand Down

0 comments on commit 6b0a7e2

Please sign in to comment.