public void WhenCallGetPriceThatThrowsNotEnoughInventoryException_ReturnsBadRequestErrorMessageResult() { string[] names = new string[] { "name of a book" }; _bookStoreService.Setup(m => m.BooksPrice(names)).Throws(new NotEnoughInventoryException()); BookStoreController controller = new BookStoreController(_bookStoreService.Object); var result = controller.GetPrice(names); Assert.IsNotNull(result); Assert.IsInstanceOf(typeof(BadRequestErrorMessageResult), result); }
public void WhenCallGetPrice_ReturnsOk() { string[] names = new string[] { "name of a book" }; _bookStoreService.Setup(m => m.BooksPrice(names)).Returns(10); BookStoreController controller = new BookStoreController(_bookStoreService.Object); var result = controller.GetPrice(names); Assert.IsNotNull(result); Assert.IsInstanceOf(typeof(OkNegotiatedContentResult <double>), result); }