public void Deve_retornar_todos_usuarios() { var users = CreateListUser(); var filter = new FilterUserDto(); var result = users.AsQueryable().Where(UserQueries.GetAll(filter)); Assert.Equal(4, result.Count()); }
public void Deve_retornar_usuarios_filtrados_por_escolaridade() { var users = CreateListUser(); var filter = new FilterUserDto() { SchoolingId = 2 }; var result = users.AsQueryable().Where(UserQueries.GetAll(filter)); Assert.Equal(2, result.Count()); }
public void Deve_retornar_usuarios_filtrados_por_data_nascimento() { var users = CreateListUser(); var filter = new FilterUserDto() { BirthDate = new DateTime(2000, 12, 1) }; var result = users.AsQueryable().Where(UserQueries.GetAll(filter)); Assert.Equal(1, result.Count()); }
public void Deve_retornar_usuarios_filtrados_por_email() { var users = CreateListUser(); var filter = new FilterUserDto() { Email = "[email protected] " }; var result = users.AsQueryable().Where(UserQueries.GetAll(filter)); Assert.Equal(1, result.Count()); }
public void Deve_retornar_usuarios_filtrados_por_sobrenome() { var users = CreateListUser(); var filter = new FilterUserDto() { LastName = " Souza" }; var result = users.AsQueryable().Where(UserQueries.GetAll(filter)); Assert.Equal(3, result.Count()); }
public IEnumerable <GetUserResumed> GetUsers() { var data = _context.Users .Where(UserQueries.GetAll()) .OrderBy(x => x.Name.FirstName) .ToList(); if (data == null) { return(null); } return(data.Select(reg => new GetUserResumed { Id = reg.Id.ToString(), Name = reg.Name.ToString(), Email = reg.Email.EmailAddress, City = reg.Address.City })); }
public QueryResultDto GetUsers(FilterUserDto filterUser) { var allUsers = _context.Users .Include(x => x.Schooling) .Where(UserQueries.GetAll(filterUser)) .AsNoTracking(); var users = allUsers.OrderBy(x => x.Id) .Skip(filterUser.CountSkip) .Take(filterUser.QuantityPerPage) .AsNoTracking(); var result = new QueryResultDto(); result.Page = filterUser.Page; result.QuantityPerPage = filterUser.QuantityPerPage; result.NumberOfRecords = allUsers.Count(); result.List = _mapper.Map <List <UserDto> >(users); return(result); }