public void ConfigMapProperties_MapsAllPropertiesToConfiguration() { //Assign FinalStubMap finalStubMap = new FinalStubMap(); PartialStub1Map partialStub1Map = new PartialStub1Map(); StubBaseMap stubBaseMap = new StubBaseMap(); PartialStub2Map partialStub2Map = new PartialStub2Map(); UmbracoFluentConfigurationLoader loader = new UmbracoFluentConfigurationLoader(); ConfigurationMap configMap = new ConfigurationMap(new IGlassMap[] { partialStub1Map, stubBaseMap, partialStub2Map, finalStubMap }); configMap.Load(loader); //Act finalStubMap.PerformMap(loader); partialStub1Map.PerformMap(loader); stubBaseMap.PerformMap(loader); partialStub2Map.PerformMap(loader); //Assert Assert.AreEqual(5, finalStubMap.GlassType.Config.Properties.Count()); UmbracoPropertyConfiguration fieldNameProperty = finalStubMap.GlassType.Config.Properties.FirstOrDefault(x => x.PropertyInfo.Name == "FieldName") as UmbracoPropertyConfiguration; Assert.AreEqual("Field Name", fieldNameProperty.PropertyName); UmbracoInfoConfiguration qwertyProperty = finalStubMap.GlassType.Config.Properties.FirstOrDefault(x => x.PropertyInfo.Name == "Qwerty") as UmbracoInfoConfiguration; Assert.AreEqual(UmbracoInfoType.Name, qwertyProperty.Type); Assert.IsNotNull(finalStubMap.GlassType.Config.IdConfig); }
public void ConfigMapProperties_ImportMap_CanOverrideExistingPropertyConfig() { //Assign FinalStubMap finalStubMap = new FinalStubMap(); FinalStubSubClassMap finalStubSubClassMap = new FinalStubSubClassMap(); PartialStub1Map partialStub1Map = new PartialStub1Map(); PartialStub2Map partialStub2Map = new PartialStub2Map(); StubBaseMap stubBaseMap = new StubBaseMap(); SitecoreFluentConfigurationLoader loader = new SitecoreFluentConfigurationLoader(); ConfigurationMap configMap = new ConfigurationMap(new IGlassMap[] { partialStub1Map, stubBaseMap, partialStub2Map, finalStubMap, finalStubSubClassMap }); configMap.Load(loader); //Act finalStubMap.PerformMap(loader); finalStubSubClassMap.PerformMap(loader); //Assert Assert.AreEqual(5, finalStubSubClassMap.GlassType.Config.Properties.Count()); SitecoreFieldConfiguration fieldNameProperty = finalStubSubClassMap.GlassType.Config.Properties.FirstOrDefault(x => x.PropertyInfo.Name == "FieldName") as SitecoreFieldConfiguration; Assert.AreEqual("Field Other Name", fieldNameProperty.FieldName); SitecoreInfoConfiguration qwertyProperty = finalStubSubClassMap.GlassType.Config.Properties.FirstOrDefault(x => x.PropertyInfo.Name == "Qwerty") as SitecoreInfoConfiguration; Assert.AreEqual(SitecoreInfoType.Name, qwertyProperty.Type); Assert.IsNotNull(finalStubSubClassMap.GlassType.Config.IdConfig); }
public void ConfigMapProperties_MapsSinglePropertyToConfiguration() { //Assign StubBaseMap stubMap = new StubBaseMap(); SitecoreFluentConfigurationLoader loader = new SitecoreFluentConfigurationLoader(); ConfigurationMap configMap = new ConfigurationMap(new IGlassMap[] { stubMap }); configMap.Load(loader); //Act stubMap.PerformMap(loader); //Assert Assert.AreEqual(1, stubMap.GlassType.Config.Properties.Count()); Assert.IsNull(stubMap.GlassType.Config.ItemConfig); }