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();
        }
Exemple #2
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));
        }
        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);
        }
Exemple #4
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();
        }