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>(); }
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); }
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); }
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); }