public void BooksPrice_ReturnsResult_Test() { string[] names = new string[] { "name" }; _store.Setup(x => x.Buy(names)).Returns(It.IsAny <double>); var result = _service.BooksPrice(names); Assert.IsNotNull(result); }
public IHttpActionResult GetPrice([FromUri] string[] bookNames) { double result = 0; try { result = _bookStoreService.BooksPrice(bookNames); } catch (NotEnoughInventoryException neix) { return(BadRequest($"Invalid shopping cart.Could not calculate price.See errors below.{neix.Message}")); } return(Ok(result)); }
public void BookStoreService_WhenBuy_ReturnsExpectedresult(string[] books, double expectedResult) { double result = _bookStoreService.BooksPrice(books); Assert.IsTrue(result == expectedResult); }