private void ConfigurationFileXmlDocumentLoadedEventHandler([CanBeNull] object sender, [NotNull] ConfigurationFileXmlDocumentLoadedEventArgs e)
    {
        Helpers.EnsureConfigurationDirectoryExistsOrThrow(e.XmlDocument.SelectElement("/iocConfiguration/appDataDir").GetAttribute("path"));

        // Lets explicitly set the DiManager to Autofac. Since we are going to test failure, the Di manager implementation does not matter.
        // However, this will give us predictability on what modules will be enabled.
        e.XmlDocument.SelectElement("/iocConfiguration/diManagers").SetAttributeValue(ConfigurationFileAttributeNames.ActiveDiManagerName, _diImplementationType.ToString());
    }
Esempio n. 2
0
        private void ConfigurationFileXmlDocumentLoadedEventHandler(DiImplementationType diImplementationType, [NotNull] ConfigurationFileXmlDocumentLoadedEventArgs e)
        {
            Helpers.ReplaceActiveDiManagerInConfigurationFile(e.XmlDocument, diImplementationType);

            var moduleClassNamesToRemove = new[] { "Modules.Autofac.AutofacModule1", "Modules.Ninject.NinjectModule1" };

            foreach (var moduleClassName in moduleClassNamesToRemove)
            {
                e.XmlDocument.SelectElement("/iocConfiguration/dependencyInjection/modules/module",
                                            x =>
                                            moduleClassName.Equals(x.GetAttribute("type"), StringComparison.Ordinal)
                                            ).Remove();
            }
        }