public static Greeting Create(string i_Type, string i_ImagePath)
        {
            Greeting greeting = null;

            if (i_Type.Equals("AnniversaryGreeting"))
            {
                greeting = new AnniversaryGreeting();
            }
            else if (i_Type.Equals("BirthdayGreeting"))
            {
                greeting = new BirthdayGreeting();
            }
            else if (i_Type.Equals("HolidayGreeting"))
            {
                greeting = new HolidayGreeting();
            }
            else if (i_Type.Equals("NewYearGreeting"))
            {
                greeting = new NewYearGreeting();
            }
            else if (i_Type.Equals("RecruitmentGreeting"))
            {
                greeting = new RecruitmentGreeting();
            }
            else if (i_Type.Equals("WeddingGreeting"))
            {
                greeting = new WeddingGreeting();
            }

            greeting.ImagePath = i_ImagePath;
            return(greeting);
        }
        public void Should_Obtains_The_Employee_Informations()
        {
            // SETUP
            var repo     = NSubstitute.Substitute.For <IRepository>();
            var greeting = new BirthdayGreeting(repo, null);
            var employeesInformationsEstimate = new List <EmployeeInformations>()
            {
                new EmployeeInformations("zaafrani", "Gabriel", new Email("*****@*****.**"), new DateTime(1990, 09, 09))
            };

            var employes = new List <Employee>()
            {
                new Employee("zaafrani", "Gabriel", "*****@*****.**", new DateTime(1990, 09, 09)),
                new Employee("zaafrani", "Michael", "*****@*****.**", new DateTime(1991, 09, 29))
            };

            // RUN
            repo.InjectEmployeesToSystem(employes).Returns(new EmployeeRepository(employes));
            var birthdayEmployees = greeting.InjectEmployeesToSystemForObtainBirthdayList(employes);

            // ARRANGE
            List <EmployeeInformations> employeesInformation = birthdayEmployees.BirthdayListInformations(09, 09);

            Check.That(employeesInformation.SequenceEqual(employeesInformationsEstimate) &&
                       employeesInformationsEstimate.SequenceEqual(employeesInformation)).IsTrue();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var employeesFile    = new EmployeesFile("Employees.csv");
            var employee         = employeesFile.Read();
            var birthdayGreeting = new BirthdayGreeting(new FileRepo(), null);

            var birthdayEmployeesService = birthdayGreeting.InjectEmployeesToSystemForObtainBirthdayList(employee);
            var liste = birthdayEmployeesService.BirthdayListInformations(29, 09);

            liste.ForEach(c => Console.WriteLine(c));
        }
예제 #4
0
        public void Should_Get_Candidate_List_From_Repository()
        {
            // SETUP
            var repository = NSubstitute.Substitute.For <IRepository>();
            var sender     = NSubstitute.Substitute.For <ISender>();
            // RUN
            var birthdayGreeting = new BirthdayGreeting(repository, sender);

            birthdayGreeting.InjectEmployeesToSystemForObtainBirthdayList(null);
            // ARRANGE
            repository.Received().InjectEmployeesToSystem(null);
        }
예제 #5
0
        public void Should_Obtains_The_Birthday()
        {
            // SETUP
            IRepository repo = new FileRepo();

            BirthdayGreeting birthdayGreeting = new BirthdayGreeting(repo, null);
            var service = birthdayGreeting.InjectEmployeesToSystemForObtainBirthdayList(employee);

            // RUN

            var employeeList = service.BirthdayListInformations(29, 09);

            // ASSERT
            Check.That(service.Exist(new Employee("zaafrani", "gabriel", "*****@*****.**",
                                                  new DateTime(1990, 09, 29)))).IsTrue();
        }
        public void Should_Obtains_The_Employee_List_For_The_Birhday()
        {
            // SETUP
            var repo     = NSubstitute.Substitute.For <IRepository>();
            var greeting = new BirthdayGreeting(repo, null);

            var employees = new List <Employee>()
            {
                new Employee("zaafrani", "Gabriel", "*****@*****.**", new DateTime(1990, 09, 09)),
                new Employee("zaafrani", "Michael", "*****@*****.**", new DateTime(1991, 09, 29))
            };

            // RUN

            repo.InjectEmployeesToSystem(employees).Returns(new EmployeeRepository(employees));


            var birthdayEmployees = greeting.InjectEmployeesToSystemForObtainBirthdayList(employees);

            // ARRANGE
            var employeeList = birthdayEmployees.BirthdayListInformations(29, 09);

            Check.That(birthdayEmployees.Exist(new Employee("zaafrani", "Michael", "*****@*****.**", new DateTime(1991, 09, 29)))).IsTrue();
        }