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); }
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); }
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); }
//[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); }