Esempio n. 1
0
        public void TestOnOffered()
        {
            Vacansy vac1 = new Vacansy()
            {
                Purpose = "level1", OfferedSummarys = new List <Summary>()
                {
                    new Summary()
                    {
                        Name = "Summary1"
                    }
                }
            };
            Vacansy vac2 = new Vacansy()
            {
                Purpose = "level1", OfferedSummarys = new List <Summary>()
                {
                    new Summary()
                    {
                        Name = "Summary2"
                    }
                }
            };
            Vacansy vac3 = new Vacansy()
            {
                Purpose = "level2", OfferedSummarys = new List <Summary>()
                {
                    new Summary()
                    {
                        Name = "Summary3"
                    }
                }
            };
            List <Vacansy> vacansies = new List <Vacansy>()
            {
                vac1, vac2, vac3
            };

            mockUnitOfWork = kernel.Get <IUnitOfWork>();
            IGenericRepository <Vacansy> mockVacansiesRepository = kernel.Get <IGenericRepository <Vacansy> >();

            mockVacansiesRepository.Get().Returns(vacansies);
            mockUnitOfWork.VacansyRepository.Returns(mockVacansiesRepository);

            interactionSubSys = new InteractionSubSystem(mockUnitOfWork);

            List <SummaryBLL> real = (List <SummaryBLL>)interactionSubSys.OnOffered(new VacansyBLL()
            {
                Purpose = "level2"
            });
            List <SummaryBLL> expected = new List <SummaryBLL>()
            {
                CustomMapper.getSummaryBLL(vac3.OfferedSummarys[0])
            };

            Assert.AreEqual(expected, real);
        }
        public void TestGetSummary()
        {
            User user1 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary1"
                }
            };
            User user2 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary2"
                }
            };
            User user3 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary3"
                }
            };
            List <User> users = new List <User>()
            {
                user1, user2, user3
            };

            mockUnitOfWork     = kernel.Get <IUnitOfWork>();
            mockUserRepository = kernel.Get <IGenericRepository <User> >();
            mockUserRepository.Get().Returns(users);
            mockUnitOfWork.UsersRepository.Returns(mockUserRepository);

            presentSubSys = new PresentSubSystem(mockUnitOfWork);

            List <SummaryBLL> expected = new List <SummaryBLL>()
            {
                CustomMapper.getSummaryBLL(user1.UserSummary), CustomMapper.getSummaryBLL(user2.UserSummary), CustomMapper.getSummaryBLL(user3.UserSummary)
            };
            List <SummaryBLL> real = (List <SummaryBLL>)presentSubSys.GetSummary();

            Assert.AreEqual(expected, real);
        }
        public void TestGetFilteredSummaries()
        {
            User user1 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary1", Position = "worker", Salary = 1000
                }
            };
            User user2 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary2", Position = "teacher", Salary = 4000
                }
            };
            User user3 = new User()
            {
                UserSummary = new Summary()
                {
                    Name = "summary3", Position = "worker", Salary = 8000
                }
            };
            List <User> users = new List <User>()
            {
                user1, user2, user3
            };

            mockUnitOfWork     = kernel.Get <IUnitOfWork>();
            mockUserRepository = kernel.Get <IGenericRepository <User> >();
            mockUserRepository.Get().Returns(users);
            mockUnitOfWork.UsersRepository.Returns(mockUserRepository);

            presentSubSys = new PresentSubSystem(mockUnitOfWork);

            List <SummaryBLL> expected = new List <SummaryBLL>()
            {
                CustomMapper.getSummaryBLL(user1.UserSummary)
            };
            List <SummaryBLL> real = (List <SummaryBLL>)presentSubSys.GetFilteredSummaries("worker", 6000, "Name");

            Assert.AreEqual(expected, real);
        }
Esempio n. 4
0
        public void TestOnSuggestedSummaries()
        {
            Summary sm1 = new Summary()
            {
                Position = "level1"
            };
            Summary sm2 = new Summary()
            {
                Position = "level2"
            };
            Summary sm3 = new Summary()
            {
                Position = "level1"
            };
            List <Summary> summary = new List <Summary>()
            {
                sm1, sm2, sm3
            };

            mockUnitOfWork = kernel.Get <IUnitOfWork>();
            IGenericRepository <Summary> mockSummaryRepository = kernel.Get <IGenericRepository <Summary> >();

            mockSummaryRepository.Get().Returns(summary);
            mockUnitOfWork.SummaryRepository.Returns(mockSummaryRepository);

            interactionSubSys = new InteractionSubSystem(mockUnitOfWork);

            List <SummaryBLL> expected = new List <SummaryBLL>()
            {
                CustomMapper.getSummaryBLL(sm1), CustomMapper.getSummaryBLL(sm3)
            };
            List <SummaryBLL> real = (List <SummaryBLL>)interactionSubSys.OnSuggestedSummaries(new VacansyBLL()
            {
                Purpose = "level1"
            });

            Assert.AreEqual(expected, real);
        }
Esempio n. 5
0
        public void TestUpdSummary()
        {
            List <User> users = new List <User>();
            User        user1 = new User()
            {
                Login = "******"
            };
            Summary sum1 = new Summary()
            {
                Info = "Some info"
            };

            user1.UserSummary = sum1;
            users.Add(user1);



            mockUnitOfWork = kernel.Get <IUnitOfWork>();
            IGenericRepository <User> mockUserRepository = kernel.Get <IGenericRepository <User> >();

            mockUserRepository.Get().Returns(users);
            mockUnitOfWork.UsersRepository.Returns(mockUserRepository);

            editSubSys = new EditSubSystem(mockUnitOfWork);

            SummaryBLL expected = new SummaryBLL()
            {
                Info = "Some updated info"
            };

            editSubSys.UpdSummary("user1", expected);

            SummaryBLL real = CustomMapper.getSummaryBLL(users.ElementAt(0).UserSummary);

            Assert.AreEqual(expected, real);
        }
 public ICollection <SummaryBLL> GetSummary()
 {
     return(uow.UsersRepository.Get()
            .Select(c => CustomMapper.getSummaryBLL(c.UserSummary)).ToList());
 }
Esempio n. 7
0
        public void TestOnApply()
        {
            List <Recrutier> recrutiers = new List <Recrutier>();
            List <Vacansy>   vac1       = new List <Vacansy>()
            {
                new Vacansy()
                {
                    Salary = 100
                }, new Vacansy()
                {
                    Salary = 200
                }
            };
            List <Vacansy> vac2 = new List <Vacansy>()
            {
                new Vacansy()
                {
                    Salary = 300
                }, new Vacansy()
                {
                    Salary = 100, OfferedSummarys = new List <Summary>()
                    {
                        new Summary()
                        {
                            Name = "Oleg"
                        }
                    }
                }
            };

            recrutiers.Add(new Recrutier()
            {
                Login = "******", vacansies = vac1
            });
            recrutiers.Add(new Recrutier()
            {
                Login = "******", vacansies = vac2
            });

            mockUnitOfWork = kernel.Get <IUnitOfWork>();
            IGenericRepository <Recrutier> mockRecruitersRepository = kernel.Get <IGenericRepository <Recrutier> >();

            mockRecruitersRepository.Get().Returns(recrutiers);
            mockUnitOfWork.RecruitersRepository.Returns(mockRecruitersRepository);

            interactionSubSys = new InteractionSubSystem(mockUnitOfWork);

            VacansyBLL vac = new VacansyBLL()
            {
                Salary = 100
            };
            Summary sm = new Summary()
            {
                Name = "Ighor"
            };

            interactionSubSys.OnApply(vac, CustomMapper.getSummaryBLL(sm));

            List <Summary> list1  = recrutiers[0].vacansies[0].OfferedSummarys;
            List <Summary> list2  = recrutiers[1].vacansies[1].OfferedSummarys;
            bool           first  = list1.Contains(sm);
            bool           second = list2.Contains(sm);

            Assert.AreEqual(recrutiers[0].vacansies[0].OfferedSummarys[0], sm);
        }