Пример #1
0
        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);
        }
Пример #2
0
        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());
        }