public void CreateApprovalMail_ReturnsApprovedMail()
        {
            var         composer    = new EmailComposer(GetHolidayApplication());
            MailMessage requestMail = composer.CreateApprovalMail();

            Assert.AreEqual(_manager.GetEmail(), requestMail.From);
            Assert.AreEqual(_requester.GetEmail(), requestMail.CC.First());
            Assert.IsTrue(requestMail.Subject.StartsWith("[approved]",
                                                         StringComparison.InvariantCultureIgnoreCase));

            string hrEmailUser    = ConfigurationManager.AppSettings["hrMail"];
            string hrEmailAddress = string.Format("{0}@{1}", hrEmailUser,
                                                  ConfigurationManager.AppSettings["companyHost"]);
            var expectedHrMail = new MailAddress(hrEmailAddress, hrEmailUser);

            Assert.AreEqual(expectedHrMail, requestMail.To);
        }
Пример #2
0
        public void Approve(HolidayApplication holidayApplication)
        {
            var composer = new EmailComposer(holidayApplication);

            Email.Send(composer.CreateApprovalMail());
        }