예제 #1
0
        public void NoBithday()
        {
            var postalOffice    = new PostalOfficeSpy();
            var employeeCatalog = new InMemoryEmployeeCatalog(
                new Employee("Al", "Capone", BirthDate.From("1951-10-08"), "*****@*****.**"),
                new Employee("Pablo", "Escobar", BirthDate.From("1975-09-11"), "*****@*****.**"),
                new Employee("John", "Wick", BirthDate.From("1987-09-11"), "*****@*****.**")
                );
            var service = new BirthdayGreetingsService(postalOffice, employeeCatalog);

            service.SendGreetings(new DateTime(2019, 2, 26));

            Assert.Empty(postalOffice.Sent);
        }
예제 #2
0
        public void ManyBithdays()
        {
            var postalOffice    = new PostalOfficeSpy();
            var employeeCatalog = new InMemoryEmployeeCatalog(
                new Employee("Al", "Capone", BirthDate.From("1951-10-08"), "*****@*****.**"),
                new Employee("Pablo", "Escobar", BirthDate.From("1975-09-11"), "*****@*****.**"),
                new Employee("John", "Wick", BirthDate.From("1987-09-11"), "*****@*****.**")
                );

            var service = new BirthdayGreetingsService(postalOffice, employeeCatalog);

            service.SendGreetings(new DateTime(2019, 9, 11));

            Assert.Equal(new List <(string name, string to)>
            {
                ("Pablo", "*****@*****.**"),
                ("John", "*****@*****.**"),
            }, postalOffice.Sent);
        }