public void ShouldGetTaskType() { MockedDatabase <TaskType> database; TaskTypeModule module; TaskType result; database = new MockedDatabase <TaskType>(false, 1, (t) => new TaskType() { TaskTypeID = (TaskTypeIDs)t }); module = new TaskTypeModule(NullLogger.Instance, database); result = module.GetTaskType(TaskTypeIDs.Idle); Assert.IsNotNull(result); Assert.AreEqual(TaskTypeIDs.Idle, result.TaskTypeID); }
public void ShouldNotGetTaskTypeAndLogError() { MockedDatabase <TaskType> database; TaskTypeModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <TaskType>(true, 1, (t) => new TaskType() { TaskTypeID = (TaskTypeIDs)t }); module = new TaskTypeModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.GetTaskType(TaskTypeIDs.MoveTo)); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }