Ejemplo n.º 1
0
        protected virtual void MockServices()
        {
            serviceProvider = Microsoft.VsSDK.UnitTestLibrary.OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Add solution Support
            BaseMock solution = MockServicesProvider.GetSolutionFactoryInstance();

            serviceProvider.AddService(typeof(IVsSolution), solution, false);

            //Add site support for ILocalRegistry
            BaseMock localRegistry = MockServicesProvider.GetLocalRegistryInstance();

            serviceProvider.AddService(typeof(SLocalRegistry), (ILocalRegistry)localRegistry, false);

            // Add site support for UI Shell
            BaseMock uiShell = MockServicesProvider.GetUiShellInstance0();

            serviceProvider.AddService(typeof(SVsUIShell), uiShell, false);
            serviceProvider.AddService(typeof(SVsUIShellOpenDocument), (IVsUIShellOpenDocument)uiShell, false);

            // Add site support for RegisterProjectTypes
            BaseMock mock = MockServicesProvider.GetRegisterProjectInstance();

            serviceProvider.AddService(typeof(SVsRegisterProjectTypes), mock, false);

            // Add site support for VsShell
            BaseMock vsShell = MockServicesProvider.GetVsShellInstance0();

            serviceProvider.AddService(typeof(SVsShell), vsShell, false);

            // Add site support for SolutionBuildManager service
            BaseMock solutionBuildManager = MockServicesProvider.GetSolutionBuildManagerInstance0();

            serviceProvider.AddService(typeof(SVsSolutionBuildManager), solutionBuildManager, false);


            // SVsFileChangeEx support
            BaseMock fileChangeEx = MockServicesProvider.GetIVsFileChangeEx();

            serviceProvider.AddService(typeof(SVsFileChangeEx), fileChangeEx, false);

            serviceProvider.AddService(typeof(ObjectExtenders), MockServicesProvider.GetObjectExtenders(), false);
        }
Ejemplo n.º 2
0
        public static void AddBasicSiteSupport(Microsoft.VsSDK.UnitTestLibrary.OleServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            // Add solution Support
            BaseMock solution = MockServicesProvider.GetSolutionFactoryInstance();

            serviceProvider.AddService(typeof(IVsSolution), solution, false);

            //Add site support for ILocalRegistry
            BaseMock localRegistry = MockServicesProvider.GetLocalRegistryInstance();

            serviceProvider.AddService(typeof(SLocalRegistry), (ILocalRegistry)localRegistry, false);

            // Add site support for UI Shell
            BaseMock uiShell = MockServicesProvider.GetUiShellInstance0();

            serviceProvider.AddService(typeof(SVsUIShell), uiShell, false);
            serviceProvider.AddService(typeof(SVsUIShellOpenDocument), (IVsUIShellOpenDocument)uiShell, false);

            // Add site support for RegisterProjectTypes
            BaseMock mock = MockServicesProvider.GetRegisterProjectInstance();

            serviceProvider.AddService(typeof(SVsRegisterProjectTypes), mock, false);

            // Add site support for VsShell
            BaseMock vsShell = MockServicesProvider.GetVsShellInstance0();

            serviceProvider.AddService(typeof(SVsShell), vsShell, false);

            // Add site support for SolutionBuildManager service
            BaseMock solutionBuildManager = MockServicesProvider.GetSolutionBuildManagerInstance0();

            serviceProvider.AddService(typeof(SVsSolutionBuildManager), solutionBuildManager, false);
        }
Ejemplo n.º 3
0
        protected virtual void MockServices()
        {
            serviceProvider = Microsoft.VsSDK.UnitTestLibrary.OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Add solution Support
            BaseMock solution = MockServicesProvider.GetSolutionFactoryInstance();
            serviceProvider.AddService(typeof(IVsSolution), solution, false);

            //Add site support for ILocalRegistry
            BaseMock localRegistry = MockServicesProvider.GetLocalRegistryInstance();
            serviceProvider.AddService(typeof(SLocalRegistry), (ILocalRegistry)localRegistry, false);

            // Add site support for UI Shell
            BaseMock uiShell = MockServicesProvider.GetUiShellInstance0();
            serviceProvider.AddService(typeof(SVsUIShell), uiShell, false);
            serviceProvider.AddService(typeof(SVsUIShellOpenDocument), (IVsUIShellOpenDocument)uiShell, false);

            // Add site support for RegisterProjectTypes
            BaseMock mock = MockServicesProvider.GetRegisterProjectInstance();
            serviceProvider.AddService(typeof(SVsRegisterProjectTypes), mock, false);

            // Add site support for VsShell
            BaseMock vsShell = MockServicesProvider.GetVsShellInstance0();
            serviceProvider.AddService(typeof(SVsShell), vsShell, false);

            // Add site support for SolutionBuildManager service
            BaseMock solutionBuildManager = MockServicesProvider.GetSolutionBuildManagerInstance0();
            serviceProvider.AddService(typeof(SVsSolutionBuildManager), solutionBuildManager, false);

            // SVsFileChangeEx support
            BaseMock fileChangeEx = MockServicesProvider.GetIVsFileChangeEx();
            serviceProvider.AddService(typeof(SVsFileChangeEx), fileChangeEx, false);
        }