Exemple #1
0
        public void MailDeliveryMethod_ReturnsSpecifiedPickupDirectory_WhenNoConfigExists()
        {
            var mockConfigReader = new Mock <IReadConfiguration>(MockBehavior.Strict);

            mockConfigReader.Setup(x => x.GetSection("system.net/mailSettings/smtp"))
            .Returns(null as ConfigurationSection);
            var appConfiguration = new AppConfiguration(mockConfigReader.Object);

            SmtpDeliveryMethod result = appConfiguration.MailDeliveryMethod;

            result.ShouldEqual(SmtpDeliveryMethod.SpecifiedPickupDirectory);
        }
Exemple #2
0
        public void MailDeliveryMethod_ReturnsValue_FromConfig(SmtpDeliveryMethod deliveryMethod)
        {
            var mockConfigReader = new Mock <IReadConfiguration>(MockBehavior.Strict);
            var smtpSection      = new SmtpSection
            {
                DeliveryMethod = deliveryMethod,
            };

            mockConfigReader.Setup(x => x.GetSection("system.net/mailSettings/smtp")).Returns(smtpSection);
            var appConfiguration = new AppConfiguration(mockConfigReader.Object);

            SmtpDeliveryMethod result = appConfiguration.MailDeliveryMethod;

            result.ShouldEqual(deliveryMethod);
        }