public async Task GetGroup_ShouldReturnNull_WhenGroupDosntExist() { // Arrange _unitOfWork.Setup(x => x.Groups.GetGroupWithInclude(It.IsAny <int>(), It.IsAny <int>())) .ReturnsAsync(() => null); // Act var result = await _sut.GetGroup(It.IsAny <int>(), It.IsAny <int>()); // Assert Assert.Null(result); }
public IActionResult GetByGid(string gid) { var group = groupsService.GetGroup(gid); if (group == null) { return(NotFound()); } return(Ok(group)); }
public async Task <IActionResult> Get(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var group = await groupsService.GetGroup(User, id); return(HandleGetResult(group, false)); }
public async Task <IActionResult> GetGroup(int id, int userId) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var group = await _groupsService.GetGroup(id, userId); if (group != null) { return(Ok(group)); } return(BadRequest()); }
public IHttpActionResult GetGroup(string groupName) { return(Ok(_groupSvc.GetGroup(groupName))); }
public IActionResult GetGroup(string name, string adminPhoneNumber) { var g = _groupsService.GetGroup(name, adminPhoneNumber); return(Ok(g)); }