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);
        }
Esempio n. 2
0
        public IActionResult GetByGid(string gid)
        {
            var group = groupsService.GetGroup(gid);

            if (group == null)
            {
                return(NotFound());
            }
            return(Ok(group));
        }
Esempio n. 3
0
        public async Task <IActionResult> Get(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var group = await groupsService.GetGroup(User, id);

            return(HandleGetResult(group, false));
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
 public IHttpActionResult GetGroup(string groupName)
 {
     return(Ok(_groupSvc.GetGroup(groupName)));
 }
Esempio n. 6
0
        public IActionResult GetGroup(string name, string adminPhoneNumber)
        {
            var g = _groupsService.GetGroup(name, adminPhoneNumber);

            return(Ok(g));
        }