private static void RemoverUsuario(UserAppService appService, UserViewModel userReturn) { var total = appService.GetAll().Count; appService.Remove(userReturn.Id); Assert.True(appService.GetAll().Count < total); }
public async Task <ActionResult> Index() { var orders = (await _ordersAppService.GetAllByUser(_inputSearch)).Items; var users = _user.UserType == UserType.User ? new List <UserDto> { await _accountAppService.MyProfile(_user.Id) } //if user is client get only his info : (await _userAppService.GetAll(_inputSearch)).Items; //else get all clients //add client info to order list var model = (from item in orders let user = users.FirstOrDefault(m => m.Id == item.UserId) where user != null select new OrderListViewModel { Guid = item.Guid, CurrentLeague = item.CurrentLeague, CurrentPoints = item.CurrentPoints, CurrentDivision = item.CurrentDivision, QueueType = item.QueueType, ServerName = item.ServerName, ServiceType = item.ServiceType, BoostType = item.BoostType, OrderStatus = item.OrderStatus, CreatorUserId = item.CreatorUserId, UserId = item.UserId, //we write the name of the use who works with this order Username = user.UserName }).ToList(); ViewBag.isUser = _user.UserType == UserType.User; return(View("Index", model)); }
public void Dever_Retornar_Todos_Usuarios() { var service = new UserService(_repository); var appService = new UserAppService(service, _mapper); var changed = appService.GetAll(); Assert.NotNull(changed); }
public ActionResult <IList <UserModel> > Get() { try { return(Ok(_userAppService.GetAll())); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }
public void ApplService_User_GetAll_Deve_Chamar_OMetodo_GetAll() { //Arrange IQueryable <User> userList = ObjectMother.userListDefault; _repository.Setup(x => x.GetAll()).Returns(userList); //Action List <User> userResultList = _appService.GetAll().ToList(); //Assert _repository.Verify(x => x.GetAll()); userResultList.Should().NotBeNull(); userResultList.Should().HaveCount(3); _repository.VerifyNoOtherCalls(); }
public IActionResult GetAll() { var list = _userAppService.GetAll(); return(Ok(list)); }