コード例 #1
0
ファイル: ProductTests.cs プロジェクト: GBoh/CCWeek3
        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"));
        }
コード例 #2
0
ファイル: ProductTests.cs プロジェクト: GBoh/CCWeek3
        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"));
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: tcMichaelson/Week3
        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."));
        }
コード例 #4
0
ファイル: ProductTests.cs プロジェクト: GBoh/CCWeek3
 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"));
 }