Skip to content

Commit

Permalink
Increase code coverage (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Mar 13, 2024
1 parent 6a819f1 commit 79614d3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Serilog.Sinks.RabbitMQ.Tests.Integration;

/// <summary>
/// Tests for using <see cref="RabbitMQSink" /> as audit sink.
/// Tests for using <see cref="RabbitMQSink" /> as audit sink.
/// </summary>
[Collection("Sequential")]
public sealed class AuditToRabbitMQSinkAuditTests : IClassFixture<RabbitMQFixture>
Expand All @@ -30,7 +30,7 @@ public AuditToRabbitMQSinkAuditTests(RabbitMQFixture rabbitMQFixture)
}

/// <summary>
/// Consumer should receive a message after calling Publish.
/// Consumer should receive a message after calling Publish.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>.
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static RabbitMQClientConfiguration GetRabbitMQClientConfiguration()
Password = Password,
ExchangeType = SerilogSinkExchangeType,
Hostnames = [SslCertHostName],
ClientProvidedName = nameof(RabbitMQFixture),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RabbitMQClientTest(RabbitMQFixture rabbitMQFixture)
}

/// <summary>
/// Consumer should receive a message after calling Publish.
/// Consumer should receive a message after calling Publish.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>.
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Serilog.Sinks.RabbitMQ.Tests.Integration;

/// <summary>
/// Tests for using <see cref="RabbitMQSink" /> as WriteTo sink.
/// Tests for using <see cref="RabbitMQSink" /> as WriteTo sink.
/// </summary>
[Collection("Sequential")]
public sealed class WriteToRabbitMQSinkTest : IClassFixture<RabbitMQFixture>
Expand Down
15 changes: 15 additions & 0 deletions tests/Serilog.Sinks.RabbitMQ.Tests/RabbitMQ/RabbitMQSinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.ObjectPool;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Debugging;
using Serilog.Events;
Expand Down Expand Up @@ -311,4 +312,18 @@ public void Emit_Should_Use_RouteKeyFunction_If_Specified(bool useRouteKeyFuncti
rabbitMQChannel.Received(1).BasicPublish(Arg.Any<PublicationAddress>(), Arg.Any<ReadOnlyMemory<byte>>());
rabbitMQChannel.ReceivedCalls().First().GetArguments()[0].ShouldBeOfType<PublicationAddress>().RoutingKey.ShouldBe(useRouteKeyFunction ? "super-key" : "some-route-key");
}

[Fact]
public void WriteTo_Should_Throw_If_Called_On_Null()
{
LoggerSinkConfiguration config = null!;
Should.Throw<ArgumentNullException>(() => config.RabbitMQ((a, b) => { })).ParamName.ShouldBe("loggerSinkConfiguration");
}

[Fact]
public void AuditTo_Should_Throw_If_Called_On_Null()
{
LoggerAuditSinkConfiguration config = null!;
Should.Throw<ArgumentNullException>(() => config.RabbitMQ((a, b) => { })).ParamName.ShouldBe("loggerAuditSinkConfiguration");
}
}

0 comments on commit 79614d3

Please sign in to comment.