Ejemplo n.º 1
0
        public void BookQuantity_ReturnsResult_Test()
        {
            _store.Setup(x => x.Quantity("name")).Returns(It.IsAny <int>);

            var result = _service.BookQuantity("name");

            Assert.IsNotNull(result);
        }
 public IHttpActionResult GetQuantity([FromUri] string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         return(BadRequest("Book name is not provided"));
     }
     else
     {
         return(Ok(_bookStoreService.BookQuantity(name)));
     }
 }
Ejemplo n.º 3
0
        public void BookStoreService__WhenCheckQuantityForBookTitle_ReturnsExpectedResult(string bookTitle, int expectedResult)
        {
            int result = _bookStoreService.BookQuantity(bookTitle);

            Assert.IsTrue(result == expectedResult);
        }