Skip to content

Commit

Permalink
Update AutofacJobActivatorTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Sep 25, 2024
1 parent 106c505 commit 8c47ea7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/Hangfire.Autofac.Tests/AutofacJobActivatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Class_IsBasedOnJobActivator()
[Fact]
public void ActivateJob_ResolvesAnInstance_UsingAutofac()
{
_builder.Register(c => "called").As<string>();
_builder.Register(_ => "called").As<string>();
var activator = CreateActivator();

var result = activator.ActivateJob(typeof(string));
Expand Down Expand Up @@ -55,7 +55,7 @@ public void ActivateJob_ResolvesServices_RegisteredInTheConfigurationAction(bool
public void InstanceRegisteredWith_InstancePerDependency_IsDisposedOnScopeDisposal()
{
var disposable = new Disposable();
_builder.Register(c => disposable).InstancePerDependency();
_builder.Register(_ => disposable).InstancePerDependency();
var activator = CreateActivator();

using (var scope = BeginScope(activator))
Expand All @@ -72,7 +72,7 @@ public void InstanceRegisteredWith_InstancePerDependency_IsDisposedOnScopeDispos
public void InstanceRegisteredWith_SingleInstance_IsNotDisposedOnScopeDisposal()
{
var disposable = new Disposable();
_builder.Register(c => disposable).SingleInstance();
_builder.Register(_ => disposable).SingleInstance();
var activator = CreateActivator();

using (var scope = BeginScope(activator))
Expand All @@ -88,7 +88,7 @@ public void InstanceRegisteredWith_SingleInstance_IsNotDisposedOnScopeDisposal()
[Fact]
public void InstancePerBackgroundJob_RegistersSameServiceInstance_ForTheSameScopeInstance()
{
_builder.Register(c => new object()).As<object>()
_builder.Register(_ => new object()).As<object>()
.InstancePerBackgroundJob();
var activator = CreateActivator();

Expand All @@ -104,7 +104,7 @@ public void InstancePerBackgroundJob_RegistersSameServiceInstance_ForTheSameScop
[Fact]
public void InstancePerBackgroundJob_RegistersDifferentServiceInstances_ForDifferentScopeInstances()
{
_builder.Register(c => new object()).As<object>().InstancePerBackgroundJob();
_builder.Register(_ => new object()).As<object>().InstancePerBackgroundJob();
var activator = CreateActivator();

object instance1;
Expand All @@ -126,7 +126,7 @@ public void InstancePerBackgroundJob_RegistersDifferentServiceInstances_ForDiffe
public void InstanceRegisteredWith_InstancePerBackgroundJob_IsDisposedOnScopeDisposal()
{
var disposable = new Disposable();
_builder.Register(c => disposable).InstancePerBackgroundJob();
_builder.Register(_ => disposable).InstancePerBackgroundJob();
var activator = CreateActivator();

using (var scope = BeginScope(activator))
Expand All @@ -141,7 +141,7 @@ public void InstanceRegisteredWith_InstancePerBackgroundJob_IsDisposedOnScopeDis
[Fact]
public void InstancePerJob_RegistersSameServiceInstance_ForTheSameScopeInstance()
{
_builder.Register(c => new object()).As<object>().InstancePerLifetimeScope();
_builder.Register(_ => new object()).As<object>().InstancePerLifetimeScope();
var activator = CreateActivator(useTaggedLifetimeScope: false);

using (var scope = BeginScope(activator))
Expand All @@ -156,7 +156,7 @@ public void InstancePerJob_RegistersSameServiceInstance_ForTheSameScopeInstance(
[Fact]
public void InstancePerJob_RegistersDifferentServiceInstances_ForDifferentScopeInstances()
{
_builder.Register(c => new object()).As<object>();
_builder.Register(_ => new object()).As<object>();
var activator = CreateActivator(useTaggedLifetimeScope: false);

object instance1;
Expand All @@ -178,7 +178,7 @@ public void InstancePerJob_RegistersDifferentServiceInstances_ForDifferentScopeI
public void InstanceRegisteredWith_InstancePerJob_IsDisposedOnScopeDisposal()
{
var disposable = new Disposable();
_builder.Register(c => disposable);
_builder.Register(_ => disposable);
var activator = CreateActivator();

using (var scope = BeginScope(activator))
Expand All @@ -194,7 +194,7 @@ public void InstanceRegisteredWith_InstancePerJob_IsDisposedOnScopeDisposal()
public void InstancePerJob_RegisteredWithExtraTags_ResolvesForJobScope()
{
var alternateLifetimeScopeTag = new object();
_builder.Register(c => new object()).As<object>()
_builder.Register(_ => new object()).As<object>()
.InstancePerBackgroundJob(alternateLifetimeScopeTag);
var activator = CreateActivator();

Expand All @@ -209,7 +209,7 @@ public void InstancePerJob_RegisteredWithExtraTags_ResolvesForJobScope()
public void InstancePerJob_RegisteredWithExtraTags_ResolvesForAlternateScope()
{
var alternateLifetimeScopeTag = new object();
_builder.Register(c => new object()).As<object>()
_builder.Register(_ => new object()).As<object>()
.InstancePerBackgroundJob(alternateLifetimeScopeTag);
var container = _builder.Build();

Expand All @@ -236,7 +236,7 @@ private AutofacJobActivator CreateActivator(

class Disposable : IDisposable
{
public bool Disposed { get; set; }
public bool Disposed { get; private set; }

public void Dispose()
{
Expand Down

0 comments on commit 8c47ea7

Please sign in to comment.