public void StartUp()
        {
            var config = new BBWTConfig {
                App = new AppConfig {
                    Name = "Test Application"
                }
            };
            var user = new User {
                Name = "*****@*****.**", FirstName = "John", Surname = "Green"
            };

            var mockConfigService = new Mock <IConfigService>();

            mockConfigService.Setup(s => s.Settings).Returns(config);

            var mockMembershipService = new Mock <IMembershipService>();

            mockMembershipService.Setup(s => s.GetCurrentUser()).Returns(user);
        }
        public void Startup()
        {
            this.template = new EmailTemplate
            {
                Id         = 1,
                Code       = "test",
                Title      = "title",
                Subject    = "#$AppName#",
                IsSystem   = true,
                From       = "#$UserEmail#",
                Notes      = "Just a note",
                Message    = "#$UserName#",
                Parameters = new List <TemplateParameter>()
            };

            var param = new TemplateParameter {
                Id = 10, Title = "Custom", Notes = "Template note", Template = this.template
            };

            this.template.Parameters.Add(param);

            var config = new BBWTConfig {
                App = new AppConfig {
                    Name = "Test Application"
                }
            };
            var user = new User {
                Name = "*****@*****.**", FirstName = "John", Surname = "Green"
            };

            var templateService   = new Mock <IEmailTemplateService>();
            var configService     = new Mock <IConfigService>();
            var membershipService = new Mock <IMembershipService>();

            templateService.Setup(s => s.GetTemplateByCode("test")).Returns(this.template);
            membershipService.Setup(s => s.GetCurrentUser()).Returns(user);
            configService.Setup(s => s.Settings).Returns(config);

            this.composer = new EmailComposer(templateService.Object, configService.Object, membershipService.Object);
        }
Beispiel #3
0
        public void StartUp()
        {
            var config = new BBWTConfig {
                App = new AppConfig {
                    Name = "Test Application"
                }
            };
            var user = new User {
                Name = "*****@*****.**", FirstName = "John", Surname = "Green"
            };

            var mockConfigService = new Mock <IConfigService>();

            mockConfigService.Setup(s => s.Settings).Returns(config);

            var mockMembershipService = new Mock <IMembershipService>();

            mockMembershipService.Setup(s => s.GetCurrentUser()).Returns(user);

            var mockEmailTemplateService = new Mock <IEmailTemplateService>();

            this.emailComposer = new EmailComposer(mockEmailTemplateService.Object, mockConfigService.Object, mockMembershipService.Object);
            this.emailSender   = new EmailSender(mockConfigService.Object, this.emailComposer);

            System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
            SmtpSection smtpSection = cfg.GetSection("system.net.mailSettings.smtp") as SmtpSection;

            if (smtpSection != null)
            {
                try
                {
                    smtpSection.DeliveryFormat = SmtpDeliveryFormat.International;
                    smtpSection.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                }
                finally
                {
                    cfg.Save();
                }
            }
        }