public void PostToCreatePresenterIsInvalid()
        {
            var mockNewPresenter = new PresenterCreationDTO(null, 1990, 2020);
            var mockRepo         = new Mock <IDataStore>();
            var sut = new ApiPresentersController(mockRepo.Object);

            sut.ModelState.AddModelError("error", "Oops something went wrong");
            IActionResult result = sut.PostNewPresenter(mockNewPresenter);

            Assert.IsType <BadRequestObjectResult>(result);
        }
        public void PostToCreatePresenterIsValid()
        {
            var mockNewPresenter     = new PresenterCreationDTO("Happy Davies", 1990, 2020);
            var mockCreatedPresenter = new PresentersDto("3", "Happy Davies", 1990, 2020);
            var mockRepo             = new Mock <IDataStore>();

            mockRepo.Setup((p) => p.AddNewPresenter(mockNewPresenter)).Returns(mockCreatedPresenter);

            var           sut    = new ApiPresentersController(mockRepo.Object);
            IActionResult result = sut.PostNewPresenter(mockNewPresenter);

            Assert.IsType <CreatedAtActionResult>(result);
        }
        public void PresenterAPIById_Returns200()
        {
            //Arrange
            var           mockRepo      = new Mock <IDataStore>();
            PresentersDto mockPresenter = new PresentersDto("1", "Bibble", 1985, 2007);

            mockRepo.Setup((repo) => repo.GetPresentersById("2"))
            .Returns(mockPresenter);

            var sut = new ApiPresentersController(mockRepo.Object);

            //Act
            IActionResult result = sut.GetPresentersById("2");

            // Asset
            Assert.IsType <OkObjectResult>(result);
        }