コード例 #1
0
        public void Should_return_specified_name_for_property_with_display_attribute_having_name_and_not_matching_resource()
        {
            // arrange
            var model = new DummyDisplayModel {
                PropertyWithDisplayAttributeHavingName = "HelloWorld"
            };

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

            // assert
            Assert.Equal("Property with DisplayAttribute with Name", metadata.DisplayName);
        }
コード例 #2
0
        public void Should_match_resource_by_property_name_if_it_exists_in_resource()
        {
            // arrange
            var model = new DummyDisplayModel {
                PropertyWithMatchingResourceKey = "HelloWorld"
            };

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

            // assert
            Assert.Equal(TestResource.PropertyWithMatchingResourceKey, metadata.DisplayName);
        }
コード例 #3
0
        public void Should_return_resource_value_for_property_with_display_attribute_containing_name_and_resource_type()
        {
            // arrange
            var model = new DummyDisplayModel {
                PropertyWithFullDisplayAttribute = "HelloWorld"
            };

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

            // assert
            Assert.Equal(TestResource2.PropertyWithFullDisplayAttribute, metadata.DisplayName);
        }
コード例 #4
0
        public void Prompt_should_match_resource_by_property_name_if_it_exists_in_resource()
        {
            // arrange
            var model = new DummyDisplayModel {
                PropertyWithMatchingResourceKeyByClassAndName = "HelloWorld"
            };

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

            // assert
            Assert.Equal(TestResource.DummyDisplayModel_PropertyWithMatchingResourceKeyByClassAndName_Prompt, metadata.Watermark);
        }