public async Task GetCommands_HasData_ReturnSuccess()
        {
            _context.Commands.AddRange(new List <Command>()
            {
                new Command()
                {
                    Id = "TEST1", Name = "Xem"
                },
                new Command()
                {
                    Id = "TEST2", Name = "Thêm"
                },
                new Command()
                {
                    Id = "TEST3", Name = "Sửa"
                },
                new Command()
                {
                    Id = "TEST4", Name = "Xoá"
                },
                new Command()
                {
                    Id = "TEST5", Name = "Duyệt"
                },
            });
            await _context.SaveChangesAsync();

            var commandsController = new CommandsController(_context);
            var result             = await commandsController.GetCommands();

            var okResult    = result as OkObjectResult;
            var FunctionVms = okResult.Value as IEnumerable <CommandVm>;

            Assert.True(FunctionVms.Count() > 0);
        }
        public void GetCommands_Returns200OK_WhenDBHasOneResource()
        {
            // Arrange

            _mockApiRepo.Setup(repo =>
                               repo.GetCommands()).Returns(GetCommands(1));

            var controller = new CommandsController(_mockApiRepo.Object, _mapper);

            // Act

            var result = controller.GetCommands().Result;

            // Assert
            Assert.IsType <OkObjectResult>(result.Result);
        }
        public async void GetCommands_ReturnsZeroItems_WhenDBIsEmpty()
        {
            // Arrange

            _mockApiRepo.Setup(repo =>
                               repo.GetCommands()).Returns(GetCommands(0));

            var controller = new CommandsController(_mockApiRepo.Object, _mapper);

            // Act

            var result = controller.GetCommands().Result;

            // Assert
            Assert.IsType <OkObjectResult>(result.Result);
        }
        public async void GetCommands_ReturnsOneItem_WhenDBHasOneResource()
        {
            // Arrange
            _mockApiRepo.Setup(repo =>
                               repo.GetCommands()).Returns(GetCommands(1));
            var controller = new CommandsController(_mockApiRepo.Object, _mapper);

            // Act
            var result = await controller.GetCommands();

            // Assert

            var okResult = result.Result as OkObjectResult;

            var commands = okResult.Value as List <CommandReadDto>;

            Assert.Single(commands);
        }