public void GetById_Return_OkResult() { //Arrange var getId = 2; var commandResponse = new Command { Id = 2, HowTo = "Integration testing", Line = "testing", Platform = ".net framework" }; _commanderMock.Setup(x => x.GetCommandById(getId)).Returns(commandResponse); var controller = new CommandsController(_commanderMock.Object, _mapperMock, _logger.Object, _telemetryClient); //Act var response = controller.GetById(getId); //Assert Assert.IsType <OkObjectResult>(response); }
public void GetByIdReturnsNullWhenInvaildId() { var result = controller.GetById(new Guid("cb74f5be-a032-4047-80f0-99c5edda037e")); Assert.Null(result.Value); }