Exemple #1
0
        public void GetAllCommands_Return200OK_WhenDBhasOneResource()
        {
            //ARRANGE

            mockRepo.Setup(repo => repo.Command.GetAllCommands()).Returns(GetCommands(1));
            var controller = new CommandController(mockRepo.Object, mapper, null);

            //ACT
            var result = controller.GetAllCommands();

            //ASSERT
            Assert.IsType <OkObjectResult>(result.Result);
        }
Exemple #2
0
        public void GetAllCommands_ReturnZeroItems_WhenDBisEmpty()
        {
            //ARRANGE

            mockRepo.Setup(repo => repo.Command.GetAllCommands()).Returns(GetCommands(0));
            var controller = new CommandController(mockRepo.Object, mapper, null);

            //ACT
            var result = controller.GetAllCommands();

            //ASSERT
            Assert.IsType <OkObjectResult>(result.Result);
        }
Exemple #3
0
        public void GetAllCommands_ReturnCorrectType_WhenDBhasOneResource()
        {
            //ARRANGE

            mockRepo.Setup(repo => repo.Command.GetAllCommands()).Returns(GetCommands(1));
            var controller = new CommandController(mockRepo.Object, mapper, null);

            //ACT
            var result = controller.GetAllCommands();

            //ASSERT
            Assert.IsType <ActionResult <IEnumerable <CommandReadDTO> > >(result);
        }
Exemple #4
0
        //[Fact]
        public void GetAllCommands_ReturnOneResource_WhenDBhasOneResource()
        {
            //ARRANGE

            mockRepo.Setup(repo => repo.Command.GetAllCommands()).Returns(GetCommands(1));
            var controller = new CommandController(mockRepo.Object, mapper, null);

            //ACT
            var result = controller.GetAllCommands();

            //ASSERT
            var okResult = result.Result as OkObjectResult;
            var commands = okResult.Value as List <CommandReadDTO>;
            //Assert.Single(commands);
        }