public async void PutWidgetWillReturnBadRequestWhenIdsDoNotMatch() { var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PutWidget(_widgets.First().Id + 1, _widgets.First()); Assert.NotNull(actionResult); Assert.IsType <BadRequestResult>(actionResult); }
public async void PutWidgetWillReturnNotFoundWhenThereAreNoChanges() { _mockedRepository.Setup(x => x.PutAsync(It.IsAny <int>(), It.IsAny <Widget>())).ReturnsAsync(0); var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PutWidget(_widgets.First().Id, _widgets.First()); Assert.NotNull(actionResult); Assert.IsType <NotFoundResult>(actionResult); }
public async void PutWidgetWillReturnOkResultWhenEverythingIsOk() { _mockedRepository.Setup(x => x.PutAsync(It.IsAny <int>(), It.IsAny <Widget>())).ReturnsAsync(1); var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PutWidget(_widgets.First().Id, _widgets.First()); Assert.NotNull(actionResult); Assert.IsType <OkObjectResult>(actionResult); }