Inheritance: ILoggerDelegate
Esempio n. 1
0
        public void SqlJobTasksShouldLeaveDebugLog()
        {
            var logger = new LoggerMock();
            var sqlJob = new SqlJob() { LoggerDelegate = logger };
            sqlJob.JobTasks.Add(new SqlJobTask("test1", "select 1 where 1=2"));
            sqlJob.Execute();

            logger.IsDebugLogged("test1").ShouldBeTrue();
        }
        public void GivenThatJobHasFailingTask()
        {
            _logger = new LoggerMock();
            _job = new Job {LoggerDelegate = _logger};

            _job.JobTasks.Add(new JobTaskToSucceed());
            _job.JobTasks.Add(new JobTaskToFail());
            _job.JobTasks.Add(new JobTaskToSucceed());
        }
        public void GivenThatJobHasFailingCommand()
        {
            _logger = new LoggerMock();
            _job = new Job {LoggerDelegate = _logger};

            _job.Commands.Add(new CommandToSucceed());
            _job.Commands.Add(new CommandToFail());
            _job.Commands.Add(new CommandToSucceed());
        }
Esempio n. 4
0
        public void JobExecutionShouldBeLogged()
        {
            var logger = new LoggerMock();
            var job = new Job { LoggerDelegate = logger };

            job.Execute();

            logger.IsLogged(LogActivity.JobStarted, job.ItemDescription).ShouldBeTrue("Job start should be logged.");
            logger.IsLogged(LogActivity.JobFinished, job.ItemDescription).ShouldBeTrue("Job finish should be logged.");
        }
        public void StoppedJobShouldBeLoggedAsCancelled()
        {
            var logger = new LoggerMock();
            var job = new Job { LoggerDelegate = logger, ProgressDelegate = this };

            job.JobTasks.Add(new JobTaskToSucceed());
            job.JobTasks.Add(new JobTaskToSucceed());
            job.Execute();

            logger.IsLogged(LogActivity.JobCancelled, job.ItemDescription);
        }
        public void FailedJobLogShouldShowUndoTasksAreExecuted()
        {
            var logger = new LoggerMock();

            var job = new Job { LoggerDelegate = logger };
            job.JobTasks.Add(new JobTaskToFailWithoutUndo());

            try
            {
                job.Execute();
            }
            catch (Exception)
            {
                job.Undo();

                logger.IsLogged(LogActivity.SkippingUndoNotDefined, job.JobTasks[0]).ShouldBeTrue("JobTask without undo instruction should log as skipping undo not defined.");

            }
        }