public void When_handle_Then_should_call_correct_methods()
        {
            // Given
            var handler = CreateTarget();
            var message = new SendTaskCompletedEmail
                              {
                                  TaskReference = "Skydiving",
                                  Title = "A jump from 127,852.4ft",
                                  Description = "Attempt world record jump from a specially designed capsule",
                                  RiskAssessorName = "Felix Baumgartner"
                              };

            // When
            handler.Handle(message);

            // Then
            _emailSender.Verify(x => x.Send(It.IsAny<RazorEmailResult>()));
        }
Пример #2
0
        public void Setup()
        {
            _furtherControlMeasureTaskService = new Mock<IFurtherControlMeasureTaskService>();
            _bus = new Mock<IBus>();

            var sendTaskCompletedEmail = new SendTaskCompletedEmail
                                             {
                                                 TaskReference = "Task Ref",
                                                 Title = "Title",
                                                 Description = "Description",
                                                 RiskAssessorName = "Fred Bloggs",
                                                 RiskAssessorEmail = "*****@*****.**"
                                             };

            _furtherControlMeasureTaskDtoWithCompletedNotification = new FurtherControlMeasureTaskDto
            {
                Reference = "Task Ref",
                Title = "Title",
                Description = "Description",
                RiskAssessment = new GeneralRiskAssessmentDto
                {
                    Id = 1001L,
                    Title = "Risk Title",
                    Reference = "Risk Reference",
                    RiskAssessor = new RiskAssessorDto()
                    {
                        Id = 213L,
                        FormattedName = "Fred Bloggs",
                        Employee = new EmployeeDto
                                       {
                                           FullName = "Fred Bloggs",
                                           MainContactDetails = new EmployeeContactDetailDto { Email = "*****@*****.**" }
                                       }
                    }
                },
                SendTaskCompletedNotification = true
            };

            _furtherControlMeasureTaskDtoWithNoCompletedNotification = new FurtherControlMeasureTaskDto
            {
                Reference = "Task Ref",
                Title = "Title",
                Description = "Description",
                RiskAssessment = new GeneralRiskAssessmentDto
                {
                    Id = 1001L,
                    Title = "Risk Title",
                    Reference = "Risk Reference",
                    RiskAssessor = new RiskAssessorDto()
                    {
                        Id = 324L,
                        FormattedName = "Fred Bloggs",

                    }
                },
                SendTaskCompletedNotification = false
            };

            _businessSafeSessionManager = new Mock<IBusinessSafeSessionManager>();

            _bus.Setup(x => x.Send(sendTaskCompletedEmail));
        }