Пример #1
0
        public void GetDefaultResourceType_should_return_null_if_defaultResourceType_and_metadataConventionsAttribute_has_no_type()
        {
            // arrange
            LocalizationConventions.DefaultResourceType = null;
            Type containerType = typeof(DummyContainerWithEmptyAttribute);

            // act
            var type = LocalizationConventions.GetDefaultResourceType(containerType);

            // assert
            Assert.Null(type);
        }
Пример #2
0
        public void GetDefaultResourceType_should_return_type_from_attributeMetadataConventions()
        {
            // arrange
            LocalizationConventions.DefaultResourceType = typeof(TestResource);
            Type containerType = typeof(DummyContainerWithAttributeAndResourceType);

            // act
            var type = LocalizationConventions.GetDefaultResourceType(containerType);

            // assert
            Assert.NotNull(type);
            Assert.Equal(type, typeof(TestResource2));
        }
Пример #3
0
        public void GetDefaultResourceType_should_return_null_if_convensions_is_not_acivated()
        {
            // arrange
            LocalizationConventions.DefaultResourceType = typeof(TestResource);
            LocalizationConventions.Enabled             = false;
            Type containerType = typeof(DummyContainer);

            // act
            var type = LocalizationConventions.GetDefaultResourceType(containerType);

            // assert
            Assert.Null(type);
        }
Пример #4
0
        public void GetDefaultResourceType_should_return_defaultResourceType_if_convensions_is_acivated()
        {
            // arrange
            LocalizationConventions.DefaultResourceType = typeof(TestResource);
            Type containerType = typeof(DummyContainer);

            // act
            var type = LocalizationConventions.GetDefaultResourceType(containerType);

            // assert
            Assert.NotNull(type);
            Assert.Equal(type, typeof(TestResource));
        }
Пример #5
0
        public void GetDefaultResourceType_should_return_defaultResourceType_if_metadataConventionsAttribute_has_no_type()
        {
            // arrange
            LocalizationConventions.DefaultResourceType = typeof(TestResource);
            LocalizationConventions.Enabled             = true;
            Type containerType = typeof(DummyContainerWithEmptyAttribute);

            // act
            var type = LocalizationConventions.GetDefaultResourceType(containerType);

            // assert
            Assert.NotNull(type);
            Assert.Equal(type, typeof(TestResource));
        }