Example #1
0
        public async Task GetFunction_HasData_ReturnSuccess()
        {
            _context.Functions.AddRange(new List <Function>()
            {
                new Function()
                {
                    Id        = "GetFunction_HasData_ReturnSuccess",
                    ParentId  = null,
                    Name      = "GetFunction_HasData_ReturnSuccess",
                    SortOrder = 1,
                    Url       = "/GetFunction_HasData_ReturnSuccess"
                }
            });
            await _context.SaveChangesAsync();

            var functionsController = new FunctionsController(_context);
            var result = await functionsController.GetFunctions();

            var okResult = result as OkObjectResult;
            var UserVms  = okResult.Value as IEnumerable <FunctionVm>;

            Assert.True(UserVms.Count() > 0);
        }
        public async Task GetFunction_HasData_ReturnSuccess()
        {
            _localizer = MockLocalizer();
            _context.Functions.AddRange(new List <Function>()
            {
                new Function()
                {
                    Id        = "GetFunction_HasData_ReturnSuccess",
                    ParentId  = null,
                    NameTemp  = "GetFunction_HasData_ReturnSuccess",
                    SortOrder = 1,
                    Url       = "/GetFunction_HasData_ReturnSuccess"
                }
            });
            await _context.SaveChangesAsync();

            var controller = new FunctionsController(_context, _mockLogger.Object, _mapper, _localizer, _returnString);
            var result     = await controller.GetFunctions();

            var okResult = result as OkObjectResult;
            var UserVms  = okResult.Value as IEnumerable <FunctionVm>;

            Assert.True(UserVms.Count() > 0);
        }