Exemple #1
0
        public void ShouldGetLastTask()
        {
            MockedDatabase <Task> database;
            TaskModule            module;
            Task result;

            database = new MockedDatabase <Task>(false, 5, (t) => new Task()
            {
                TaskID = t
            });
            module = new TaskModule(NullLogger.Instance, database);
            result = module.GetLastTask(1);
            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.TaskID);
        }
Exemple #2
0
        public void ShouldNotGetLastTaskAndLogError()
        {
            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.GetLastTask(1));
            Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName)));
        }