コード例 #1
0
        public void DispatchShouldSendCorrectSubjectAndMessage()
        {
            var emailService = new Mock<IEmailService>();
            var emailNotificationDispatcher = new EmailNotificationDispatcher(
                emailService.Object, CreateTemplateServiceStub().Object, CreateLocalizedDataSourceStub().Object);

            emailNotificationDispatcher.Dispatch(CreateNotifiableStub().Object, CreateNotificationStub().Object);

            emailService.Verify(x => x.Send(EmailAddress, Subject, Body, UseHtmlEmail));
        }
コード例 #2
0
        public void DispatchShouldInvokeLocalizedDataSource()
        {
            var localizedDataSource = new Mock<ILocalizedDataSource>();
            var emailNotificationDispatcher = new EmailNotificationDispatcher(
                new Mock<IEmailService>().Object, new Mock<ITemplateService>().Object, localizedDataSource.Object);

            emailNotificationDispatcher.Dispatch(CreateNotifiableStub().Object, CreateNotificationStub().Object);

            localizedDataSource.Verify(x => x.GetContent(MessageType, LanguageCode));
        }
コード例 #3
0
        public void DispatchShouldInvokeTemplateService()
        {
            var templateService = new Mock<ITemplateService>();
            var emailNotificationDispatcher = new EmailNotificationDispatcher(
                new Mock<IEmailService>().Object, templateService.Object, CreateLocalizedDataSourceStub().Object);

            emailNotificationDispatcher.Dispatch(CreateNotifiableStub().Object, CreateNotificationStub().Object);

            templateService.Verify(x => x.Parse(TemplateText, Parameter));
        }
コード例 #4
0
        public void DispatchShouldInvokeEmailService()
        {
            var emailService = new Mock<IEmailService>();
            var emailNotificationDispatcher = new EmailNotificationDispatcher(
                emailService.Object, new Mock<ITemplateService>().Object, new Mock<ILocalizedDataSource>().Object);

            emailNotificationDispatcher.Dispatch(CreateNotifiableStub().Object, CreateNotificationStub().Object);

            emailService.Verify(x => x.Send(EmailAddress, It.IsAny<string>(), It.IsAny<string>(), UseHtmlEmail));
        }