public void CanAddProduct_NullProduct_ThrowsException() { // Arrange ProductValidator productValidator = new ProductValidator(); Product product = null; // Act // Assert Assert.ThrowsException <ArgumentNullException>(() => productValidator.CanAddProduct(product)); }
public void CanAddProduct_ProductHasEmptyPrice_ReturnErrorMessage() { // Arrange ProductValidator productValidator = new ProductValidator(); Product product = new Product(); product.Name = "Name"; product.Description = "Description"; // Act List <KeyValuePair <string, string> > result = productValidator.CanAddProduct(product); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); Assert.AreEqual("Price", result[0].Key); }