예제 #1
0
        protected LocalizationTestsBase()
        {
            Registry = new Mock <IModelMetadataRegistry>();
            Provider = new ExtendedModelMetadataProvider(Registry.Object);

            DefaultConventionsResourceType = LocalizationConventions.DefaultResourceType;
            LocalizationConventions.DefaultResourceType = typeof(TestResource);
        }
예제 #2
0
        public FluentConfigurationDisplayConvensionTests()
        {
            registry = new ModelMetadataRegistry();
            provider = new ExtendedModelMetadataProvider(registry);
            metadataConfiguration = new DummyDisplayModelConfiguration();

            registry.RegisterConfiguration(metadataConfiguration);

            LocalizationConventions.Enabled = true;
            LocalizationConventions.RequireConventionAttribute = false;
        }
예제 #3
0
        public void ShouldHaveSameConvertEmptyStringToNull()
        {
            var registryMock = new Mock <IModelMetadataRegistry>();

            registryMock.Setup(x => x.GetModelPropertiesMetadata(It.IsAny <Type>())).Returns(new DummyObjectConfiguration().Configurations);

            var provider   = new ExtendedModelMetadataProvider(registryMock.Object);
            var properties = provider.GetMetadataForProperties(null, typeof(DummyObject)).ToArray();

            Assert.Equal(2, properties.Count());

            var first  = properties[0];
            var second = properties[1];

            Assert.Equal(second.ConvertEmptyStringToNull, first.ConvertEmptyStringToNull);
        }
 public ExtendedModelMetadataProviderTests()
 {
     registry = new Mock <IModelMetadataRegistry>();
     provider = new ExtendedModelMetadataProvider(registry.Object);
 }
 public ExtendedModelMetadataProviderTests()
 {
     registry = new Mock<IModelMetadataRegistry>();
     provider = new ExtendedModelMetadataProvider(registry.Object);
 }