コード例 #1
0
 public void when_preference_is_within_set_productattribute_then_match()
 {
     MetaAttribute houseSuburb = new MetaAttributeBuilder().HouseSuburb();
     Preference houseSuburbPreference = new PreferenceBuilder().WithMetaAttribute(houseSuburb).WithRawValues("Milton,Cleveland,Broken Hill").Build();
     ProductAttribute houseSuburbProductAttribute = new ProductAttributeBuilder().WithMetaAttribute(houseSuburb).WithRawValue("Cleveland").Build();
     Assert.IsTrue(houseSuburbPreference.IsMatchOn(houseSuburbProductAttribute));
 }
コード例 #2
0
 public void when_preference_is_within_range_productattribute_then_match()
 {
     MetaAttribute housePrice = new MetaAttributeBuilder().HousePrice();
     Preference housePricePreference = new PreferenceBuilder().WithMetaAttribute(housePrice).WithRawValues("30000000-45000000").Build();
     ProductAttribute housePriceProductAttribute = new ProductAttributeBuilder().WithMetaAttribute(housePrice).WithRawValue("44000000").Build();
     Assert.IsTrue(housePricePreference.IsMatchOn(housePriceProductAttribute));
 }
コード例 #3
0
 public void when_preference_and_productattribute_have_different_metaattribute_then_match()
 {
     MetaAttribute housePrice = new MetaAttributeBuilder().HousePrice();
     MetaAttribute houseSuburb = new MetaAttributeBuilder().HouseSuburb();
     Preference housePricePreference = new PreferenceBuilder().WithMetaAttribute(housePrice).WithRawValues("30000000-45000000").Build();
     ProductAttribute houseSuburbProductAttribute = new ProductAttributeBuilder().WithMetaAttribute(houseSuburb).WithRawValue("Cleveland").Build();
     Assert.IsTrue(housePricePreference.IsMatchOn(houseSuburbProductAttribute));
 }
コード例 #4
0
 public void when_name_is_null_validation_fails()
 {
     var ma = new MetaAttributeBuilder().WithName(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(ma, "Name");
 }
コード例 #5
0
 public void when_name_is_more_than_50_characters_validation_fails()
 {
     var ma = new MetaAttributeBuilder().WithName(GetCharacters(51)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(ma, "Name");
 }
コード例 #6
0
 public void when_name_is_less_than_51_characters_validation_passes()
 {
     var ma = new MetaAttributeBuilder().WithName(GetCharacters(50)).Build();
     AssertIsValid(ma);
 }
コード例 #7
0
 public void when_name_is_empty_validation_passes()
 {
     var ma = new MetaAttributeBuilder().WithName(String.Empty).Build();
     AssertIsValid(ma);
 }
コード例 #8
0
 public void when_choices_is_null_validation_fails()
 {
     var ma = new MetaAttributeBuilder().WithChoices(null).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(ma, "Choices");
 }
コード例 #9
0
 public void when_choices_is_more_than_7500_characters_validation_fails()
 {
     var ma = new MetaAttributeBuilder().WithChoices(GetCharacters(7501)).Build();
     AssertInvalidWithAtLeastOneErrorOnProperty(ma, "Choices");
 }
コード例 #10
0
 public void when_choices_is_less_than_256_characters_validation_passes()
 {
     var ma = new MetaAttributeBuilder().WithChoices(GetCharacters(255)).Build();
     AssertIsValid(ma);
 }
コード例 #11
0
ファイル: BuyerTests.cs プロジェクト: liammclennan/Herald
        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));
        }