Example #1
0
        public void NameValidation()
        {
            MetaProduct mp = new MetaProductBuilder().Build();
            mp.Name = null;
            AssertInvalidWithAtLeastOneErrorOnProperty(mp, "Name");

            mp.Name = String.Empty;
            AssertIsValid(mp);

            mp.Name = GetCharacters(50);
            AssertIsValid(mp);

            mp.Name = GetCharacters(51);
            AssertInvalidWithAtLeastOneErrorOnProperty(mp, "Name");
        }
Example #2
0
 public void when_description_is_null_then_validation_fails()
 {
     var mp = new MetaProductBuilder().WithDescrtipion(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(mp, "Description");
 }
Example #3
0
 public void when_description_is_more_than_200_characters_validation_fails()
 {
     var mp = new MetaProductBuilder().WithDescrtipion(GetCharacters(201)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(mp, "Description");
 }
Example #4
0
 public void when_description_is_less_than_201_characters_validation_passes()
 {
     var mp = new MetaProductBuilder().WithDescrtipion(GetCharacters(200)).Build();
     AssertIsValid(mp);
 }
Example #5
0
 public void when_description_is_empty_then_validation_passes()
 {
     var mp = new MetaProductBuilder().WithDescrtipion(String.Empty).Build();
     AssertIsValid(mp);
 }
Example #6
0
 public void when_a_meta_attribute_is_invalid_then_the_meta_product_is_invalid()
 {
     var mp = new MetaProductBuilder().Build();
     mp.MetaAttributes.Add(new MetaAttributeBuilder().WithName(null).Build());
     Assert.IsFalse(mp.IsValid);
 }