예제 #1
0
        public async Task <IActionResult> Get(string key)
        {
            if (!await _permissionService.Authorize(PermissionSystemName.Categories))
            {
                return(Forbid());
            }

            var category = await _categoryApiService.GetById(key);

            if (category == null)
            {
                return(NotFound());
            }

            return(Ok(category));
        }
        public void Can_GetById()
        {
            var category = _categoryApiService.GetById(_id1);

            // Assert
            Assert.IsNotNull(category);
            Assert.AreEqual("sample category 1", category.Name);
        }