public ClaimsIdentity CreateRecruiterIdentity(RecruiterUser user)
 {
     var identity = new ClaimsIdentity(new[] {
             new Claim(ClaimTypes.Name, user.Name),
             new Claim(ClaimTypes.Sid, user.Id),
             new Claim(ClaimTypes.Role, "Recruiter"),
             new Claim(ClaimTypes.Email, user.Email)
         }, "ApplicationCookie");
     return identity;
 }
 private async Task<RecruiterUser> CreateAndInsertRecruiterUser(string name, int recruiterNumber)
 {
     var recruiterUser = new RecruiterUser()
     {
         Name = name + recruiterNumber,
         Email = name + recruiterNumber + "@" + name + ".pl",
     };
     SetPassword(recruiterUser, "recruiter");
     await _databaseService.InsertRecruiterUserAsync(recruiterUser);
     return recruiterUser;
 }
        public async Task CanGetRecruiterByEmail()
        {
            var recruiterUser = new RecruiterUser() { CompanyDescription = "a", Id = "12345", Name = "b" };
            
            dbService
                .Setup(r => r.GetRecruterByEmailAsync(It.IsAny<string>()))
                .Returns(Task<RecruiterUser>.FromResult(recruiterUser));   

            var result = await applicationService.GetRecruterByEmailAsync("blsabla");

            Assert.AreEqual(result.Id, recruiterUser.Id);
        }
 public async Task InsertRecruiterUserAsync(RecruiterUser user)
 {
     await dbContext.RecruiterUsers.InsertOneAsync(user);
 }
        public async Task UpdateRecruiterAsync(RecruiterUser recruiter, string recruiterId)
        {
            var filter = Builders<RecruiterUser>.Filter.Eq(r => r.Id, recruiterId);
            var update = Builders<RecruiterUser>
                .Update
                .Set(r => r.CompanyDescription, recruiter.CompanyDescription)
                .Set(r => r.CompanyName, recruiter.CompanyName);

            await dbContext.RecruiterUsers.UpdateOneAsync(filter, update);
        }
 public RecruiterUser MapToRecruiterUser(string name, string email)
 {
     var user = new RecruiterUser
     {
         Name = name,
         Email = email,
     };
     return user;
 }
        public RecruiterUser MapToRecruiterUser(RecruiterModel recruiterModel)
        {
            var recruiter = new RecruiterUser()
            {
                CompanyDescription = recruiterModel.CompanyDescription,
                CompanyName = recruiterModel.CompanyName,

            };
            return recruiter;
        }
 public RecruiterModel MapToRecruiterModel(RecruiterUser recruiter)
 {
     var recruiterModel = new RecruiterModel(recruiter.CompanyName, recruiter.CompanyDescription);
     return recruiterModel;
 }
 private async Task<string> GetRecruiterId(RecruiterUser recruiterUser)
 {
     var recruiter = await _databaseService.GetRecruterByEmailAsync(recruiterUser.Email);
     return recruiter.Id;
 }