public void Prompt_should_match_resource_by_class_and_property_names_if_it_exists_in_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel { PropertyWithMatchingResourceKey = "HelloWorld" };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithMatchingResourceKey");

            // assert
            Assert.Equal(TestResource.PropertyWithMatchingResourceKey_Prompt, metadata.Watermark);
        }
        public void Should_match_resource_by_class_and_property_names_if_it_exists_in_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel { PropertyWithMatchingResourceKeyByClassAndName = "HelloWorld" };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithMatchingResourceKeyByClassAndName");

            // assert
            Assert.Equal(TestResource.AttrDummyDisplayModel_PropertyWithMatchingResourceKeyByClassAndName, metadata.DisplayName);
        }
예제 #3
0
        public void Should_match_resource_by_property_name_if_it_exists_in_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel {
                PropertyWithMatchingResourceKey = "HelloWorld"
            };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithMatchingResourceKey");

            // assert
            Assert.Equal(TestResource.PropertyWithMatchingResourceKey, metadata.DisplayName);
        }
예제 #4
0
        public void Should_return_resource_value_for_property_with_display_attribute_containing_name_and_resource_type()
        {
            // arrange
            var model = new AttrDummyDisplayModel {
                PropertyWithFullDisplayAttribute = "HelloWorld"
            };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithFullDisplayAttribute");

            // assert
            Assert.Equal(TestResource2.PropertyWithFullDisplayAttribute, metadata.DisplayName);
        }
예제 #5
0
        public void Should_return_resource_value_for_property_with_display_attribute_matching_resource_key()
        {
            // arrange
            var model = new AttrDummyDisplayModel {
                PropertyWithDisplayAttributeMatchingResourceKey = "HelloWorld"
            };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithDisplayAttributeMatchingResourceKey");

            // assert
            Assert.Equal(TestResource.AttrDummyDisplayModel_PropertyWithDisplayAttributeMatchingResourceKey, metadata.DisplayName);
        }
예제 #6
0
        public void Should_return_specified_name_for_property_with_display_attribute_having_name_and_not_matching_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel {
                PropertyWithDisplayAttributeHavingName = "HelloWorld"
            };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithDisplayAttributeHavingName");

            // assert
            Assert.Equal("Property with DisplayAttribute with Name", metadata.DisplayName);
        }
예제 #7
0
        public void Prompt_should_match_resource_by_property_name_if_it_exists_in_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel {
                PropertyWithMatchingResourceKeyByClassAndName = "HelloWorld"
            };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithMatchingResourceKeyByClassAndName");

            // assert
            Assert.Equal(TestResource.AttrDummyDisplayModel_PropertyWithMatchingResourceKeyByClassAndName_Prompt, metadata.Watermark);
        }
        public void Should_return_resource_value_for_property_with_display_attribute_containing_name_and_resource_type()
        {
            // arrange
            var model = new AttrDummyDisplayModel { PropertyWithFullDisplayAttribute = "HelloWorld" };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithFullDisplayAttribute");

            // assert
            Assert.Equal(TestResource2.PropertyWithFullDisplayAttribute, metadata.DisplayName);
        }
        public void Should_return_specified_name_for_property_with_display_attribute_having_name_and_not_matching_resource()
        {
            // arrange
            var model = new AttrDummyDisplayModel { PropertyWithDisplayAttributeHavingName = "HelloWorld" };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithDisplayAttributeHavingName");

            // assert
            Assert.Equal("Property with DisplayAttribute with Name", metadata.DisplayName);
        }
        public void Should_return_resource_value_for_property_with_display_attribute_matching_resource_key()
        {
            // arrange
            var model = new AttrDummyDisplayModel { PropertyWithDisplayAttributeMatchingResourceKey = "HelloWorld" };

            // act
            var metadata = provider.GetMetadataForProperty(() => model, model.GetType(), "PropertyWithDisplayAttributeMatchingResourceKey");

            // assert
            Assert.Equal(TestResource.AttrDummyDisplayModel_PropertyWithDisplayAttributeMatchingResourceKey, metadata.DisplayName);
        }