public void NullTestPut() { //Arrange Mock <IStockApplicationService> mockStockApplicationService = new Mock <IStockApplicationService>(); StockDto stock = null; StocksController stocksController = new StocksController(mockStockApplicationService.Object); //Act IActionResult actionResult = stocksController.Post(stock); //Assert Assert.IsType <BadRequestObjectResult>(actionResult); }
public void TestPut() { //Arrange Mock <IStockApplicationService> mockStockApplicationService = new Mock <IStockApplicationService>(); StockDto stock = new StockDto() { TotalPrice = 5000, TotalQuantity = 500, }; StocksController stocksController = new StocksController(mockStockApplicationService.Object); //Act IActionResult actionResult = stocksController.Post(stock); //Assert Assert.IsType <CreatedResult>(actionResult); }