Example #1
0
 public void when_name_is_longer_than_150_characters_then_validation_fails()
 {
     var p = new ProductBuilder().WithName(GetCharacters(151)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Name");
 }
Example #2
0
 public void when_name_is_null_then_validation_fails()
 {
     var p = new ProductBuilder().WithName(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Name");
 }
Example #3
0
 public void when_description_is_shorter_than_4001_characters_then_validation_passes()
 {
     var p = new ProductBuilder().WithDescription(GetCharacters(4000)).Build();
     AssertIsValid(p);
 }
Example #4
0
 public void when_name_is_empty_then_validation_passes()
 {
     var p = new ProductBuilder().WithName(String.Empty).Build();
     AssertIsValid(p);
 }
Example #5
0
 public void when_description_is_longer_than_4000_characters_then_validation_fails()
 {
     var p = new ProductBuilder().WithDescription(GetCharacters(4001)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Description");
 }
Example #6
0
 public void when_description_is_null_then_validation_fails()
 {
     var p = new ProductBuilder().WithDescription(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Description");
 }
Example #7
0
 public void when_address_is_shorter_than_201_characters_then_validation_passes()
 {
     var p = new ProductBuilder().WithAddress(GetCharacters(50)).Build();
     AssertIsValid(p);
 }
Example #8
0
 public void when_attributes_are_invalid_then_the_product_is_invalid()
 {
     var p = new ProductBuilder().Build();
     p.ProductAttributes.Add(new ProductAttributeBuilder().WithRawValue(GetCharacters(900)).Build());
     Assert.IsFalse(p.IsValid);
 }
Example #9
0
 public void when_address_is_null_then_validation_fails()
 {
     var p = new ProductBuilder().WithAddress(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Address");
 }
Example #10
0
 public void when_address_is_longer_than_200_characters_then_validation_fails()
 {
     var p = new ProductBuilder().WithAddress(GetCharacters(201)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(p, "Address");
 }
Example #11
0
 public void when_name_is_shorter_than_151_characters_then_validation_passes()
 {
     var p = new ProductBuilder().WithName(GetCharacters(150)).Build();
     AssertIsValid(p);
 }
Example #12
0
        public void when_preference_does_match_productattribute_then_match()
        {
            var housePrice = new MetaAttributeBuilder().HousePrice(); // Currency / Range

            var product = new ProductBuilder().Product440000;
            var buyer = new BuyerBuilder().Build();
            buyer.Preferences.Add(new PreferenceBuilder().WithMetaAttribute(housePrice).WithRawValues("30000000-45000000").Build());
            Assert.IsTrue(buyer.IsMatch(product));
        }
Example #13
0
        public void when_product_has_no_productattributes_then_everything_matches()
        {
            var products = new ProductBuilder().GetCollectionOfProductsWithNoProductAttributes().ToList();
            var buyer = new BuyerBuilder().Build();

            products.ForEach(p => Assert.IsTrue(buyer.IsMatch(p)));

            buyer.Preferences.Add(new PreferenceBuilder().WithMetaAttribute(new MetaAttributeBuilder().HousePrice()).Build());
            products.ForEach(p => Assert.IsTrue(buyer.IsMatch(p)));
        }