Ejemplo n.º 1
0
        public void TestPriceNot17()
        {
            var product = new Product {
                Name = "Apple",
                Price = 17m
            };

            var results = TestHelper.Validate(product);
            Assert.IsTrue(results.Any(p => p.ErrorMessage == "Price cannot be $17.00"));
        }
Ejemplo n.º 2
0
        public void PriceGreaterThan0()
        {
            var product = new Product {
                Name = "Apple",
                Price = -1m
            };

            var results = TestHelper.Validate(product);
            Assert.IsTrue(results.Any(p => p.ErrorMessage == "Price must be larger than $0.00"));
        }
Ejemplo n.º 3
0
        public void TestProductNameRequired()
        {
            var product = new Product {
                Name = "",
                Price = 3.33m
            };

            var results = TestHelper.Validate(product);

            Assert.IsTrue(results.Any(p => p.ErrorMessage == "Name is required."));
        }
Ejemplo n.º 4
0
 public void ProductNameRequired()
 {
     //Arrange
     var product = new Product {
         Name = "",
         Price = 1.00m,
     };
     //Act
     var results = TestHelper.Validate(product);
     //Assert
     Assert.IsTrue(results.Any(p => p.ErrorMessage == "Product name is required"));
 }