public void RequiredValidation_should_use_specified_resourcename_and_resourcetype_should_be_set_from_global_resource() { const string PropertyName = "PropertyToTestResNamePartialMetadata"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); Assert.Equal(TestResource.PropertyToTestResNamePartialMetadata, errorMessage); }
public void RequiredValidation_should_use_specified_resource_and_resourcename_should_be_set_by_convensions() { const string PropertyName = "PropertyToTestResTypePartialMetadata"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); Assert.Equal(TestResource2.AttrLocalizationModel_PropertyToTestResTypePartialMetadata_Required, errorMessage); }
public void RequiredValidation_should_always_use_user_defined_message_from_resource() { const string PropertyName = "AttrLocalizedByKeyWithCustomMessageForPropertyFromRes"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); Assert.Equal(TestResource.CustomMessageForProperty, errorMessage); }
public void RequiredValidation_should_use_common_convention_if_it_is_found_but_convension_for_type_does_not_exist() { // arrange const string PropertyName = "AttrLocalizedByCommonPattern"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); // assert Assert.Equal(TestResource.Validation_Required, errorMessage); }
public void RequiredValidation_should_return_resource_value_if_resource_is_set_and_custom_error_message_is_not_defined() { // arrange const string PropertyName = "AttrLocalizedByKey"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); // assert Assert.Equal(TestResource.AttrLocalizationModel_AttrLocalizedByKey_Required, errorMessage); }
public void RequiredValidation_should_always_use_user_defined_message() { const string PropertyName = "AttrLocalizedByKeyWithUserMessage"; const string UserMessage = "user message"; var model = new AttrLocalizationModel(); var errorMessage = GetErrorMessageForAttributeBasedConfigiguredItem(model, PropertyName); Assert.Equal(UserMessage, errorMessage); }