Skip to content

Commit

Permalink
test: fix test was not properly configured to hit the correct overload (
Browse files Browse the repository at this point in the history
  • Loading branch information
skwasjer authored Oct 6, 2024
1 parent 7a1c224 commit c6dccf9
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Hangfire.Common;
using Correlate;
using Hangfire.Common;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

Expand All @@ -14,6 +15,9 @@ public abstract class GlobalConfigurationExtensionsTests : GlobalTestContext
[Fact]
public void When_using_it_should_register_filter()
{
GlobalJobFilters.Filters.Should()
.NotContain(f => f.Instance is CorrelateFilterAttribute);

Use(_configMock);

GlobalJobFilters.Filters.Should()
Expand Down Expand Up @@ -121,7 +125,14 @@ string expectedParamName

protected override void Use(IGlobalConfiguration configuration)
{
configuration.UseCorrelate(Substitute.For<ILoggerFactory>());
IServiceProvider serviceProviderMock = Substitute.For<IServiceProvider>();
serviceProviderMock
.GetService(typeof(ICorrelationContextAccessor))
.Returns(Substitute.For<ICorrelationContextAccessor>());
serviceProviderMock
.GetService(typeof(IActivityFactory))
.Returns(Substitute.For<IActivityFactory>());
configuration.UseCorrelate(serviceProviderMock);
}
}
}

0 comments on commit c6dccf9

Please sign in to comment.