Ejemplo n.º 1
0
        public void willSendGreetings_whenItsSomebodysBirthday()
        {
            service.SendGreetings(FILE_NAME, new XDate("2008/10/08"), "localhost", smtpServer.Port);

            Assert.AreEqual(1, smtpServer.ReceivedEmailCount, "message not sent?");
            var message = smtpServer.ReceivedEmail [0];

            Assert.AreEqual("Happy Birthday, dear John!", message.MessageParts[0].BodyData);
            Assert.AreEqual("Happy Birthday!", message.Headers.Get("subject"));
            Assert.AreEqual(1, message.ToAddresses.Length);
            Assert.AreEqual("*****@*****.**", message.ToAddresses[0].ToString());
        }
Ejemplo n.º 2
0
        private void StartBirthdayServiceFor(String employeeFileName, String date)
        {
            var service = new BirthdayService();

            service.SendGreetings(employeeFileName, new XDate(date), "localhost", NONSTANDARD_PORT);
            emailIterator = server.ReceivedEmail;
        }
Ejemplo n.º 3
0
        void ExecuteBirthdayServiceFor(string employeeFileName, string date)
        {
            IGreetingMessageService greetingMessageService = new GreetingMessageService("localhost", NONSTANDARD_PORT, "*****@*****.**");
            IEmployeeRepository     employeeRepository     = new FileEmployeeRepository(employeeFileName);
            var service = new BirthdayService(greetingMessageService, employeeRepository);

            service.SendGreetings(new XDate(date));
            emailIterator = server.ReceivedEmail;
        }