public void ProductControllerListingMethodReturnsHttpResponseMessage() { var prodSrvc = new Mock<IProductService>(); ProductController ctrl = new ProductController(prodSrvc.Object, new JsonHttpResponseService()); var result = ctrl.Listing(); Assert.IsInstanceOfType(result, typeof(HttpResponseMessage)); }
public void ProductControllerListingMethodReturnsJsonEnumerableOfProductModels() { var expResp = new JsonHttpResponseService().GetObjectHttpResponseMessage(makeProdList()); var prodSrvc = new Mock<IProductService>(); prodSrvc.Setup(s => s.Listing()).Returns(makeProdList()); ProductController ctrl = new ProductController(prodSrvc.Object, new JsonHttpResponseService()); var ctrlResp = ctrl.Listing(); TestHelpers.HttpRespStringsAreEqual(expResp, ctrlResp); }