public async void PostWidgetWillReturnBadRequestForEmptyWidget() { var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PostWidget(null); Assert.NotNull(actionResult); Assert.IsType <BadRequestResult>(actionResult.Result); }
public async void PostWidgetWillReturnOkResultWhenEverythingIsOk() { _mockedRepository.Setup(x => x.AddAsync(It.IsAny <Widget>())).ReturnsAsync(1); var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PostWidget(_widgets.First()); Assert.NotNull(actionResult); Assert.IsType <OkObjectResult>(actionResult.Result); }
public async void PostWidgetWithWrongDataWillReturnNotFound() { _mockedRepository.Setup(x => x.AddAsync(It.IsAny <Widget>())).ReturnsAsync(0); var myController = new WidgetsController(_mockedRepository.Object); var actionResult = await myController.PostWidget(_widgets.First()); Assert.NotNull(actionResult); Assert.IsType <NotFoundResult>(actionResult.Result); }