public IEnumerable <ApplicationRole> Get([FromQuery] string filter, [FromQuery] int skip = 0, [FromQuery] int top = 0) { var totalCount = new OptionalOutTotalCount(); var roles = _securityService.GetRoles(filter, skip, top, totalCount).ToList(); Request.SetListTotalCount(totalCount.Value); return(roles); }
public void GetRoles_WithData_valid() { // Mock var role1 = new Role() { Id = Guid.NewGuid() }; var role2 = new Role() { Id = Guid.NewGuid() }; var role3 = new Role() { Id = Guid.NewGuid() }; bool isActive = true; _roleRepository.GetRoles(isActive).Returns(new List <Role> { role1, role2, role3 }); // execute var result = _sut.GetRoles(isActive); // Assert.IsNotNull(result); Assert.AreEqual(3, result.Count()); }