예제 #1
0
        public void TestCheckUser()
        {
            User user1 = new User()
            {
                Login = "******", Password = "******"
            };
            User user2 = new User()
            {
                Login = "******", Password = "******"
            };
            List <User> users = new List <User>()
            {
                user1, user2
            };

            Recrutier recrutier1 = new Recrutier()
            {
                Login = "******", Password = "******"
            };
            Recrutier recrutier2 = new Recrutier()
            {
                Login = "******", Password = "******"
            };
            List <Recrutier> recrutiers = new List <Recrutier>()
            {
                recrutier1, recrutier2
            };

            Admin admin1 = new Admin()
            {
                Login = "******", Password = "******"
            };
            Admin admin2 = new Admin()
            {
                Login = "******", Password = "******"
            };
            List <Admin> admins = new List <Admin>()
            {
                admin1, admin2
            };

            mockUnitOfWork = kernel.Get <IUnitOfWork>();

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

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

            IGenericRepository <Recrutier> mockRecrutierRepository = kernel.Get <IGenericRepository <Recrutier> >();

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

            IGenericRepository <Admin> mockAdminRepository = kernel.Get <IGenericRepository <Admin> >();

            mockAdminRepository.Get().Returns(admins);
            mockUnitOfWork.AdminsRepository.Returns(mockAdminRepository);

            verificationSubSys = new VerificationSubSystem(mockUnitOfWork);

            AdminBLL expected = CustomMapper.getAdminBLL(admin1);
            AdminBLL real     = (AdminBLL)verificationSubSys.CheckUser("admin1", ":");

            Assert.AreEqual(expected.Login, real.Login);
        }
 public object checkUser(string login, string password)
 {
     return(verificationSystem.CheckUser(login, password));
 }