public void Can_Run_Jobs_With_No_Params() { var next = JobCreator.Create <SampleJobNoParam>((j) => j.DoThing()); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); Xunit.Assert.True(SampleJobNoParam.Called); }
public void Can_Run_Jobs_With_Static_Method() { var next = JobCreator.Create <SampleJobStaticMethod>((j) => SampleJobStaticMethod.DoThing()); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); Xunit.Assert.True(SampleJobStaticMethod.Called); }
public void Creator_Respects_StaticJob_Handling() { var next = JobCreator.Create <StaticClassJob>((j) => SampleJobStaticClass.DoThing()); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); Xunit.Assert.True(SampleJobStaticClass.Called); }
public void Can_Run_Static_Method_On_Static_Class() { var next = JobCreator.Create <object>((j) => SampleJobStaticClass.DoThing()); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); Xunit.Assert.True(SampleJobStaticClass.Called); }
public void Can_Run_Jobs_With_Param_Type_Matching_And_Overloads() { var myValue = new ClassTest() { classTestValue = TestConstants.classTestValue }; var next = JobCreator.Create <SampleJob2>((j) => j.DoThing(TestConstants.derp, TestConstants.herp, myValue)); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); }
public void Can_Run_Job_With_Simple_Method_Calls() { var myValue = new ClassTest() { classTestValue = TestConstants.classTestValue }; var next = JobCreator.Create <SampleJob>((j) => j.DoThing(TestConstants.derp, int.Parse(TestConstants.herp.ToString()), myValue)); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); }
public void Can_Run_Job_And_pass_parameters() { var myValue = new ClassTest() { classTestValue = TestConstants.classTestValue }; var next = JobCreator.Create <SampleJob>((j) => j.DoThing(TestConstants.derp, TestConstants.herp, myValue)); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); }
public void Can_Run_Job_With_Arity_in_class_With_Arity() { var myvalue = new ClassTest() { classTestValue = TestConstants.classTestValue }; var next = JobCreator.Create <SampleJobInGenericClass <string> >(j => j.DoThing(TestConstants.derp, TestConstants.herp, myvalue)); var jobEx = new DefaultJobExecutor(new DefaultContainerFactory()); jobEx.ExecuteJob(next); }
public virtual void testJobExecutorConfigurationProperties() { // given JobExecutor jobExecutor = new DefaultJobExecutor(); IDictionary <string, string> propertiesToSet = new Dictionary <string, string>(); propertiesToSet[MAX_JOBS_PER_ACQUISITION] = Convert.ToString(int.MaxValue); propertiesToSet[MAX_WAIT] = Convert.ToString(long.MaxValue); propertiesToSet[WAIT_INCREASE_FACTOR] = Convert.ToString(float.MaxValue); propertiesToSet[BACKOFF_TIME_IN_MILLIS] = Convert.ToString(int.MaxValue); // when PropertyHelper.applyProperties(jobExecutor, propertiesToSet); // then Assert.assertEquals(int.MaxValue, jobExecutor.MaxJobsPerAcquisition); Assert.assertEquals(long.MaxValue, jobExecutor.MaxWait); Assert.assertEquals(float.MaxValue, jobExecutor.WaitIncreaseFactor, 0.0001d); Assert.assertEquals(int.MaxValue, jobExecutor.BackoffTimeInMillis); }