Ejemplo n.º 1
0
        public void Configure_ConfigurationIsIncorrectType_ExceptionThrown()
        {
            //Assign
            var attr   = new UmbracoTypeAttribute();
            var config = Substitute.For <AbstractTypeConfiguration>();
            var type   = typeof(StubClass);

            //Act

            //Assert
            attr.Invoking(a => a.Configure(type, config)).ShouldThrow <ConfigurationException>();
        }
Ejemplo n.º 2
0
        public void Configure_ConfigurationIsOfCorrectType_NoExceptionThrown()
        {
            //Assign
            var attr = new UmbracoTypeAttribute();
            var type = typeof(StubClass);

            //Act
            var config = attr.Configure(type);

            //Assert
            config.Type.ShouldBeEquivalentTo(type);
        }
Ejemplo n.º 3
0
        public void Configure_AttributeHasContentTypeName_ContentTypeNameSetOnConfig()
        {
            //Assign
            var attr = new UmbracoTypeAttribute();
            var type = typeof(StubClass);

            var contentTypeNameExpected = "test";

            attr.ContentTypeName = contentTypeNameExpected;

            //Act
            var config = attr.Configure(type) as UmbracoTypeConfiguration;

            //Assert
            config.Type.ShouldBeEquivalentTo(type);
            config.ContentTypeName.ShouldBeEquivalentTo(contentTypeNameExpected);
        }
Ejemplo n.º 4
0
        public void Configure_AttributeHasContentTypeAlias_ContentTypeAliasSetOnConfig()
        {
            //Assign
            var attr   = new UmbracoTypeAttribute();
            var config = new UmbracoTypeConfiguration();
            var type   = typeof(StubClass);

            var contentTypeAliasExpected = "test";

            attr.ContentTypeAlias = contentTypeAliasExpected;

            //Act
            attr.Configure(type, config);

            //Assert
            config.Type.ShouldBeEquivalentTo(type);
            config.ContentTypeAlias.ShouldBeEquivalentTo(contentTypeAliasExpected);
        }