Exemplo n.º 1
0
        public void Initialize(EnterpriseConfig config)
        {
            var databaseInstalled = DataSettingsHelper.DatabaseIsInstalled();

            if (databaseInstalled)
            {
                //startup tasks
                //RunStartupTasks();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a factory instance and adds a http application injecting facility.
        /// </summary>
        /// <returns>A new factory</returns>
        public static IEngine CreateEngineInstance(EnterpriseConfig config)
        {
            if (config != null && !string.IsNullOrEmpty(config.EngineType))
            {
                var engineType = Type.GetType(config.EngineType);
                if (engineType == null)
                {
                    throw new ConfigurationErrorsException("The type '" + engineType + "' could not be found. Please check the configuration at /configuration/nop/engine[@engineType] or check for missing assemblies.");
                }
                if (!typeof(IEngine).IsAssignableFrom(engineType))
                {
                    throw new ConfigurationErrorsException("The type '" + engineType + "' doesn't implement 'Nop.Core.Infrastructure.IEngine' and cannot be configured in /configuration/nop/engine[@engineType] for that purpose.");
                }
                return(Activator.CreateInstance(engineType) as IEngine);
            }

            return(new Engine());
        }
Exemplo n.º 3
0
        public void Verify(string resourceName)
        {
            //  build a standard configurationsection with properties (using the mock object)
            var enterpriseConfig = new EnterpriseConfig();

            XmlHelper.UseAll = true;

            var       configType = enterpriseConfig.GetType();
            var       generator  = new XsdGenerator(configType);
            XmlSchema schema     = generator.GenerateXsd(configType.FullName);
            var       schemaXml  = SchemaToString(schema);

            var schemas = new XmlSchemaSet();

            schemas.Add("http://JFDI.Utils.XSDExtractor.UnitTests.ConfigurationClasses.EnterpriseConfig", XmlReader.Create(new StringReader(schemaXml)));
            schemas.CompilationSettings.EnableUpaCheck = true;
            schemas.Compile();

            var assembly = Assembly.GetExecutingAssembly();

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                var doc = new XmlDocument();
                doc.Load(stream);

                doc.Schemas.Add(schemas);

                Debug.WriteLine(doc.OuterXml);


                Debug.WriteLine("------------------");
                doc.Validate(((sender, args) =>
                {
                    Debug.WriteLine("{0} {1}", args.Message, args.Severity);
                    Assert.Fail(args.Message);
                }));
            }
        }