public async Task GivenJobWithConstructorArgs_ItResolvesThemFromTheContainer()
            {
                // Arrange
                var expected = new SomeService();
                var host     = new TestServiceHost(
                    componentRegistrations: b => {
                    b.RegisterInstance(expected).As <SomeService>();
                });

                host.Initialize();

                var job = new JobDescription("test", typeof(TestJobWithService));

                var dispatcher = new JobDispatcher(new[] { job }, host.Container);
                var invocation = TestHelpers.CreateInvocation(Guid.NewGuid(), "Test", "test", new Dictionary <string, string>());
                var context    = new InvocationContext(invocation, queue: null);
                var slot       = new ContextSlot();

                TestJobWithService.SetContextSlot(slot);

                // Act
                await dispatcher.Dispatch(context);

                // Assert
                Assert.Same(expected, slot.Value);
            }
            public async Task GivenJobWithConstructorArgs_ItResolvesThemFromTheContainer()
            {
                // Arrange
                var expected = new SomeService();
                var host = new TestServiceHost(
                    componentRegistrations: b => {
                        b.RegisterInstance(expected).As<SomeService>();
                    });
                host.Initialize();

                var job = new JobDescription("test", typeof(TestJobWithService));

                var dispatcher = new JobDispatcher(new[] { job }, host.Container);
                var invocation = TestHelpers.CreateInvocation(Guid.NewGuid(), "Test", "test", new Dictionary<string, string>());
                var context = new InvocationContext(invocation, queue: null);
                var slot = new ContextSlot();
                TestJobWithService.SetContextSlot(slot);
                
                // Act
                await dispatcher.Dispatch(context);
                
                // Assert
                Assert.Same(expected, slot.Value);
            }
 // Call context doesn't flow up the call stack, only down, but it's
 // a shallow copy (i.e. objects are copied as references), so we can
 // use a property on a dummy object to fake passing things up the call stack in the test
 internal static void SetContextSlot(ContextSlot value)
 {
     CallContext.LogicalSetData(typeof(TestJobWithService).FullName + "!ContextSlot", value);
 }
 // Call context doesn't flow up the call stack, only down, but it's
 // a shallow copy (i.e. objects are copied as references), so we can
 // use a property on a dummy object to fake passing things up the call stack in the test
 internal static void SetContextSlot(ContextSlot value)
 {
     CallContext.LogicalSetData(typeof(TestJobWithService).FullName + "!ContextSlot", value);
 }