Skip to content

Commit

Permalink
Better test for job constructor arguments roundtrip
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Dec 10, 2024
1 parent 928da7f commit dbc1d38
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/Hangfire.Core.Tests/Common/JobFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,17 @@ public void Ctor_ThrowsAnException_WhenMethodContains_UnassignedGenericTypeParam
}

[Fact]
public void Ctor_CorrectlyPasses_ReadOnlyListOfArguments()
public void Ctor_CanUsePropertyValues_OfAnotherJob_AsItsArguments()
{
var method = _type.GetMethod("MethodWithArguments");
IReadOnlyList<object> args = new List<object> { "hello", 123 };
var job = new Job(_type, method, args);
var job = new Job(_type, method, "hello", 456);

Assert.NotNull(job);
Assert.Equal("hello", job.Args[0]);
Assert.Equal(123, job.Args[1]);
var anotherJob = new Job(job.Type, job.Method, job.Args);

Assert.Equal(_type, anotherJob.Type);
Assert.Equal(method, anotherJob.Method);
Assert.Equal("hello", anotherJob.Args[0]);
Assert.Equal(456, anotherJob.Args[1]);
}

[Fact]
Expand Down

0 comments on commit dbc1d38

Please sign in to comment.