public void TaskResponsibleChanged(TaskResponsibleChangedData data)
        {
            if (!_setting.UseMandrill)
            {
                return;
            }

            var message = new EmailMessage
            {
                to = new[] { new EmailAddress(data.EmployeeEmail) },
                from_email = _setting.MandrillFrom,
                subject = _setting.MandrillTaskResponsibleChangedNotificationSubject
            };

            message.AddGlobalVariable("TASKNAME", data.TaskTitle);
            message.AddGlobalVariable("TASKROLE", data.Role);

            _api.SendMessage(message, _setting.MandrillTaskResponsibleNotificationTemplate, null);
        }
 public void TaskResponsibleChanged(TaskResponsibleChangedData data)
 { }
        public void NextStep_WhenNotLastStep_NotifyEmployee()
        {
            using (var context = ContextHelper.Create())
            {
                var employee = context.AddEmployee();
                var task = context.AddTask();
                context.AddTaskStep();

                var model = this.ValidNextStep(context);
                model.EmployeeId = employee.EmployeeId;

                var mockNotifier = A.Fake<INotifier>();
                var service = Factory.CreateTaskService(context, notifier: mockNotifier);


                Helper.Suppress(() => service.NextStep(model, null));

                var notificationData = new TaskResponsibleChangedData(task, employee);
                A.CallTo(() => mockNotifier.TaskResponsibleChanged(notificationData)).MustHaveHappened();
            }
        }
        public void Create_Always_NotifyEmployee()
        {
            using (var context = ContextHelper.Create())
            {
                var employee = context.AddEmployee();

                var model = ValidTaskCreate(context);
                model.EmployeeId = employee.EmployeeId;

                var mockNotifier = A.Fake<INotifier>();
                var service = Factory.CreateTaskService(context, notifier: mockNotifier);


                Helper.Suppress(() => service.Save(model, null));
                var task = context.Tasks.First(x => x.TaskId == model.TaskId);


                var notifyData = new TaskResponsibleChangedData(task, employee);
                A.CallTo(() => mockNotifier.TaskResponsibleChanged(notifyData)).MustHaveHappened();
            }
        }