public void Load_StubClassConfigured_ReturnsStubClassAndProperties() { //Assign var loader = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Tests"); //Act var results = loader.Load(); //Assert Assert.GreaterOrEqual(results.Count(), 0); var typeConfig = results.First(x => x.Type == typeof (StubClass)); Assert.IsNotNull(typeConfig); var propertyNames = new[] {"Children", "Field", "Id", "Info", "Linked", "Node", "Parent", "Query"}; foreach(var propertyName in propertyNames) { var propInfo = typeof (StubClass).GetProperty(propertyName); Assert.IsTrue(typeConfig.Properties.Any(x=>x.PropertyInfo == propInfo)); } }
public void BasicTemplate_LoadedByAttributeLoader() { //Assign var loader = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Upgrade.Tests"); //Act var configs = loader.Load(); //Assert var basicTemplate = configs.First(x => x.Type == typeof(BasicTemplate)); var subClass = configs.First(x => x.Type == typeof(SubClass)); Assert.IsNotNull(basicTemplate); Assert.IsNotNull(subClass); #region SitecoreId CheckProperty(basicTemplate, "Id", typeof(SitecoreIdConfiguration)); #endregion #region Fields #region Simple Types CheckProperty(basicTemplate, "Checkbox", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Date", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "DateTime", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "File", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Image", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Integer", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Float", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Double", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Decimal", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "MultiLineText", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Number", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Password", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "RichText", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "SingleLineText", typeof(SitecoreFieldConfiguration)); #endregion #region List Types CheckProperty(basicTemplate, "CheckList", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "DropList", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "GroupedDropLink", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "GroupedDropList", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "MultiList", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "Treelist", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "TreeListEx", typeof(SitecoreFieldConfiguration)); #endregion #region Link Types CheckProperty(basicTemplate, "DropLink", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "DropTree", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "GeneralLink", typeof(SitecoreFieldConfiguration)); #endregion #region Developer Types CheckProperty(basicTemplate, "Icon", typeof(SitecoreFieldConfiguration)); CheckProperty(basicTemplate, "TriState", typeof(SitecoreFieldConfiguration)); #endregion #region SystemType CheckProperty(basicTemplate, "Attachment", typeof(SitecoreFieldConfiguration)); #endregion #endregion #region SitecoreInfo CheckProperty(basicTemplate, "ContentPath", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "DisplayName", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "FullPath", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "Key", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "MediaUrl", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "Path", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "TemplateId", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "TemplateName", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "Url", typeof(SitecoreInfoConfiguration)); CheckProperty(basicTemplate, "Version", typeof(SitecoreInfoConfiguration)); #endregion #region SitecoreChildren CheckProperty(basicTemplate, "Children", typeof(SitecoreChildrenConfiguration)); #endregion #region SitecoreParent CheckProperty(basicTemplate, "Parent", typeof(SitecoreParentConfiguration)); #endregion #region SitecoreQuery CheckProperty(basicTemplate, "Query", typeof(SitecoreQueryConfiguration)); #endregion }