public void ShouldDeleteTask() { MockedDatabase <Task> database; TaskModule module; database = new MockedDatabase <Task>(false, 1, (t) => new Task() { TaskID = t }); module = new TaskModule(NullLogger.Instance, database); module.DeleteTask(1); Assert.AreEqual(1, database.DeletedCount); }
public void ShouldNotDeleteTaskAndLogError() { MockedDatabase <Task> database; TaskModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <Task>(true, 1, (t) => new Task() { TaskID = t }); module = new TaskModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.DeleteTask(1)); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }
public IActionResult DeleteTask(string TASK_ID) => Ok(TM.DeleteTask(TASK_ID));