private static void AddTrustedDependencies(IDependencyManager dependencyManager)
        {
            IDataTypeFascade            dataTypeFascade;
            IReflectionFascade          reflectionFascade;
            IConfigurationRoot          configurationRoot;
            IAppConfigFascade           appConfigFascade;
            IAssemblyInformationFascade assemblyInformationFascade;

            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dataTypeFascade            = new DataTypeFascade();
            reflectionFascade          = new ReflectionFascade(dataTypeFascade);
            configurationRoot          = LoadAppConfigFile(APP_CONFIG_FILE_NAME);
            appConfigFascade           = new AppConfigFascade(configurationRoot, dataTypeFascade);
            assemblyInformationFascade = new AssemblyInformationFascade(reflectionFascade, Assembly.GetEntryAssembly());

            dependencyManager.AddResolution <IConfigurationRoot>(string.Empty, false, new SingletonWrapperDependencyResolution <IConfigurationRoot>(new InstanceDependencyResolution <IConfigurationRoot>(configurationRoot)));
            dependencyManager.AddResolution <IDataTypeFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <IDataTypeFascade>(new InstanceDependencyResolution <IDataTypeFascade>(dataTypeFascade)));
            dependencyManager.AddResolution <IReflectionFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <IReflectionFascade>(new InstanceDependencyResolution <IReflectionFascade>(reflectionFascade)));
            dependencyManager.AddResolution <IAppConfigFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <IAppConfigFascade>(new InstanceDependencyResolution <IAppConfigFascade>(appConfigFascade)));
            dependencyManager.AddResolution <IAssemblyInformationFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <IAssemblyInformationFascade>(new InstanceDependencyResolution <IAssemblyInformationFascade>(assemblyInformationFascade)));
        }
        public static void OnDependencyMagic(IDependencyManager dependencyManager)
        {
            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.AddResolution <AsyncExecutableApplicationFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <AsyncExecutableApplicationFascade>(TransientActivatorAutoWiringDependencyResolution <PipelineHostConsoleApplication> .From(dependencyManager)));
            dependencyManager.AddResolution <IToolHost>(string.Empty, false, new SingletonWrapperDependencyResolution <IToolHost>(TransientActivatorAutoWiringDependencyResolution <ToolHost> .From(dependencyManager)));
            dependencyManager.AddResolution <IAdoNetBufferingFascade>(string.Empty, false, new SingletonWrapperDependencyResolution <IAdoNetBufferingFascade>(TransientActivatorAutoWiringDependencyResolution <AdoNetBufferingFascade> .From(dependencyManager)));
        }
Пример #3
0
        private static void AddTrustedDependencies(IDependencyManager dependencyManager)
        {
            IAppSettingsFacade  appSettingsFacade;
            AssemblyInformation assemblyInformation;

            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            appSettingsFacade   = AppSettingsFacade.Default;
            assemblyInformation = AssemblyInformation.Default;

            dependencyManager.AddResolution <IAppSettingsFacade>(string.Empty, false, new SingletonWrapperDependencyResolution <IAppSettingsFacade>(new InstanceDependencyResolution <IAppSettingsFacade>(appSettingsFacade)));
            dependencyManager.AddResolution <AssemblyInformation>(string.Empty, false, new SingletonWrapperDependencyResolution <AssemblyInformation>(new InstanceDependencyResolution <AssemblyInformation>(assemblyInformation)));
        }
Пример #4
0
        public static void IsValidDependencyMagicMethod(IDependencyManager dependencyManager)
        {
            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            MockFactory           mockFactory;
            IDependencyResolution mockDependencyResolution;

            IDependencyManager _unusedDependencyManager = null;
            Type   _unusedType   = null;
            string _unusedString = null;
            Type   targetType;
            string selectorKey;
            bool   includeAssignableTypes;

            mockFactory = new MockFactory();
            mockDependencyResolution = mockFactory.CreateInstance <IDependencyResolution>();

            targetType             = typeof(IFormattable);
            selectorKey            = UNCOMMON_SELECTOR_KEY;
            includeAssignableTypes = false;

            dependencyManager.AddResolution(targetType, selectorKey, includeAssignableTypes, mockDependencyResolution);

            Expect.On(mockDependencyResolution).Any.Method(m => m.Resolve(_unusedDependencyManager, _unusedType, _unusedString)).With(dependencyManager, targetType, selectorKey).WillReturn(1234.5678);

            Expect.On(mockDependencyResolution).One.Method(m => m.Dispose());
        }
Пример #5
0
        public static void OnDependencyMagic(IDependencyManager dependencyManager)
        {
            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.AddResolution <TextMetalConsoleApplication>(string.Empty, false, new SingletonWrapperDependencyResolution <TextMetalConsoleApplication>(TransientActivatorAutoWiringDependencyResolution <TextMetalConsoleApplication> .From(dependencyManager)));
        }
Пример #6
0
        public static void OnDependencyMagic(IDependencyManager dependencyManager)
        {
            if ((object)dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.AddResolution <SolderExeApp>(string.Empty, false, new SingletonWrapperDependencyResolution <SolderExeApp>(new TransientActivatorAutoWiringDependencyResolution <SolderExeApp>()));
        }