Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
 public IActionResult DeleteTask(string TASK_ID) => Ok(TM.DeleteTask(TASK_ID));