public void OnStopNoServices() { var factory = Substitute.For <ITaskFactory <object> >(); var manager = new RoleTaskManager <object>(factory); manager.OnStop(); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { var manager = new RoleTaskManager<object>(new Factory()); manager.OnStart(); var host = new JobHost(); manager.Run(); host.RunAndBlock(); manager.OnStop(); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { var manager = new RoleTaskManager <object>(new Factory()); manager.OnStart(); var host = new JobHost(); manager.Run(); host.RunAndBlock(); manager.OnStop(); }
public void OnStopThrows() { var services = new List <IRunnable>(); var service = Substitute.For <IRunnable>(); service.When(s => s.Stop()).Do(x => { throw new Exception(); }); services.Add(service); var factory = Substitute.For <ITaskFactory <object> >(); factory.Tasks(Arg.Any <RoleTaskManager <object> >()).Returns(services); var manager = new RoleTaskManager <object>(factory); manager.OnStart(); manager.OnStop(); service.Received().Stop(); factory.Received().Tasks(Arg.Any <RoleTaskManager <object> >()); }
public void OnStop() { var tasks = new List <IRunnable>(); var task = Substitute.For <IRunnable>(); task.Stop(); tasks.Add(task); var factory = Substitute.For <ITaskFactory <object> >(); factory.Tasks(Arg.Any <RoleTaskManager <object> >()).Returns(tasks); var manager = new RoleTaskManager <object>(factory); manager.OnStart(); manager.OnStop(); task.Received().Stop(); factory.Received().Tasks(Arg.Any <RoleTaskManager <object> >()); }
public void OnStopNoServices() { var factory = Substitute.For<ITaskFactory<object>>(); var manager = new RoleTaskManager<object>(factory); manager.OnStop(); }
public void OnStopThrows() { var services = new List<IRunnable>(); var service = Substitute.For<IRunnable>(); service.When(s => s.Stop()).Do(x => { throw new Exception(); }); services.Add(service); var factory = Substitute.For<ITaskFactory<object>>(); factory.Tasks(Arg.Any<RoleTaskManager<object>>()).Returns(services); var manager = new RoleTaskManager<object>(factory); manager.OnStart(); manager.OnStop(); service.Received().Stop(); factory.Received().Tasks(Arg.Any<RoleTaskManager<object>>()); }
public void OnStop() { var tasks = new List<IRunnable>(); var task = Substitute.For<IRunnable>(); task.Stop(); tasks.Add(task); var factory = Substitute.For<ITaskFactory<object>>(); factory.Tasks(Arg.Any<RoleTaskManager<object>>()).Returns(tasks); var manager = new RoleTaskManager<object>(factory); manager.OnStart(); manager.OnStop(); task.Received().Stop(); factory.Received().Tasks(Arg.Any<RoleTaskManager<object>>()); }