public void TestControllerRecurringJob() { ICronApiService cron = new MockCronApiService(); IProgramingMethodService methodService = new MockProgramingMethodService(); RecurringJobController controller = new RecurringJobController(cron, methodService, null, null); var result = controller.AddExecution(Guid.NewGuid().ToString(), "prueba_job", "07/05/2022 12:36", "*/15 * * * *", "07/05/2001 12:36"); if (result is BadRequestObjectResult) { Assert.True(false); } else { Assert.True(true); } }
public void TestControllerRecurringJobExistName() { ICronApiService cron = new MockCronApiService(); IProgramingMethodService methodService = new MockProgramingMethodService(); RecurringJobController controller = new RecurringJobController(cron, methodService, null, null); var result = controller.AddExecution(Guid.NewGuid().ToString(), "0", "07/05/2022 12:36", " */ 15 * * * *", "07/05/2001 12:36"); if (result is BadRequestObjectResult) { Assert.True(((BadRequestObjectResult)result).Value.Equals("Ya existe una tarea con ese nombre")); } else { Assert.True(false); } }