public ActionResult <ProductOutputModel> DeleteProduct(long id) { var validationResult = _productValidator.ValidateProductId(id); if (!string.IsNullOrEmpty(validationResult)) { return(UnprocessableEntity(validationResult)); } var result = _productManager.DeleteProduct(id); return(MakeResponse <ProductOutputModel, ProductOutputModel>(result)); }
public void ProductIdtValidationIsCorrect(long product, DataAgent <List <ProductOutputModel> > model, string expected) { // Given _manager.Setup(m => m.FindProducts(new ProductSearchInputModel { Id = product })).Returns(model); // _manager.SetReturnsDefault(model); // When string actual = _validator.ValidateProductId(product); // Then Assert.IsTrue(model.ContainsData); Assert.AreEqual(expected, actual); }