public void GetConfiguration_ReturnsConfigurationFromDisk() { var provider = new UmbracoCodeGeneratorConfigurationProvider(Path.Combine(Environment.CurrentDirectory, @"..\..\config\codegen.config")); var config = provider.GetConfiguration(); Assert.AreEqual("SomeBaseClass", config.DocumentTypes.BaseClass); Assert.AreEqual("String", config.DefaultTypeMapping); Assert.AreEqual(true, config.DocumentTypes.GenerateClasses); Assert.AreEqual(true, config.DocumentTypes.GenerateXml); Assert.AreEqual("Models/DocumentTypes", config.DocumentTypes.ModelPath); Assert.AreEqual("MyWeb.Models", config.DocumentTypes.Namespace); Assert.AreEqual("pfx", config.DocumentTypes.RemovePrefix); Assert.AreEqual(false, config.OverwriteReadOnly); Assert.AreNotEqual(0, config.TypeMappings.Count); Assert.AreEqual("Int32", config.TypeMappings["1413afcb-d19a-4173-8e9a-68288d2a73b8"]); }
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver()); var configurationProvider = new UmbracoCodeGeneratorConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config")); uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration(); dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder); dataTypes = dataTypesProvider.GetDataTypes(); configuration = configurationProvider.GetConfiguration(); paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath)); paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath)); XmlDoc.Saved += OnDocumentTypeSaved; if (configuration.DocumentTypes.GenerateXml) GenerateXml(configuration.DocumentTypes); if (configuration.MediaTypes.GenerateXml) GenerateXml(configuration.MediaTypes); }