當前位置: 首頁>>代碼示例>>C#>>正文


C# UnitTestLibrary.GenericMockFactory類代碼示例

本文整理匯總了C#中Microsoft.VsSDK.UnitTestLibrary.GenericMockFactory的典型用法代碼示例。如果您正苦於以下問題:C# GenericMockFactory類的具體用法?C# GenericMockFactory怎麽用?C# GenericMockFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GenericMockFactory類屬於Microsoft.VsSDK.UnitTestLibrary命名空間,在下文中一共展示了GenericMockFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetSite

        public void SetSite()
        {
            // Create the package
            var package = new PowerToolsCommandsPackage() as IVsPackage;
            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            var serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            var activityLogMock =
                new GenericMockFactory(
                    "MockVsActivityLog",
                    new[] { typeof(Microsoft.VisualStudio.Shell.Interop.IVsActivityLog) }
                    ).GetInstance();

            serviceProvider.AddService(
                typeof(Microsoft.VisualStudio.Shell.Interop.SVsActivityLog),
                activityLogMock,
                true);

            // Site the package
            //Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
開發者ID:v2m,項目名稱:FSharpVSPowerTools,代碼行數:26,代碼來源:PackageTest.cs

示例2: GetPBInstance

 /// <summary>
 /// Returns a property bag that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetPBInstance()
 {
     if (PBFactory == null)
         PBFactory = new GenericMockFactory("PropertyBag", new Type[] { typeof(IPropertyBag) });
     BaseMock pb = PBFactory.GetInstance();
     return pb;
 }
開發者ID:rsweeney21,項目名稱:VisualGit,代碼行數:11,代碼來源:MockPropertyBag.cs

示例3: GetBaseMonSelInstance

 /// <summary>
 /// Returns a monitor selection object that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetBaseMonSelInstance()
 {
     if (MonSelFactory == null)
         MonSelFactory = new GenericMockFactory("MonitorSelection", new Type[] { typeof(IVsMonitorSelection), typeof (IVsMultiItemSelect) });
     BaseMock pb = MonSelFactory.GetInstance();
     return pb;
 }
開發者ID:rsweeney21,項目名稱:VisualGit,代碼行數:11,代碼來源:MockIVsMonitorSelection.cs

示例4: GetRegisterEditorsInstance

 /// <summary>
 /// Returns an SVsRegisterEditors service that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetRegisterEditorsInstance()
 {
     if (registerEditorFactory == null)
         registerEditorFactory = new GenericMockFactory("SVsRegisterEditors", new Type[] { typeof(IVsRegisterEditors) });
     BaseMock registerEditor = registerEditorFactory.GetInstance();
     return registerEditor;
 }
開發者ID:Graham-Pedersen,項目名稱:IronPlot,代碼行數:11,代碼來源:RegisterEditorsServiceMock.cs

示例5: TestOutputNoPane

        public void TestOutputNoPane() {
            // Create an instance of the package and initialize it so that the GetService
            // will succeed, but the GetPane will fail.

            // As first create a service provider.
            using(OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices()) {
                // Now create the mock object for the output window.
                if(null == mockOutputWindowFactory) {
                    mockOutputWindowFactory = new GenericMockFactory("MockOutputWindow", new Type[] { typeof(IVsOutputWindow) });
                }
                BaseMock mockBase = mockOutputWindowFactory.GetInstance() as BaseMock;
                mockBase.AddMethodReturnValues(string.Format("{0}.{1}", typeof(IVsOutputWindow).FullName, "GetPane"),
                                               new object[] { -1, Guid.Empty, null });
                // Add the output window to the services provided by the service provider.
                serviceProvider.AddService(typeof(SVsOutputWindow), mockBase, false);

                // Create an instance of the package and initialize it calling SetSite.
                SrcMLServicePackage package = new SrcMLServicePackage();
                int result = ((IVsPackage)package).SetSite(serviceProvider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");

                // Now we can create an instance of the service
                SetUpSrcMLServiceExtensionDirectory();
                SrcMLGlobalService service = new SrcMLGlobalService(package, extensionDirectory);
                
                service.GlobalServiceFunction();
                                
                ((IVsPackage)package).SetSite(null);
                ((IVsPackage)package).Close();
            }
        }
開發者ID:nkcsgexi,項目名稱:SrcML.NET,代碼行數:31,代碼來源:SrcMLGlobalServiceTests.cs

示例6: GetBaseRegisterScciProvider

 /// <summary>
 /// Return a IVsRegisterScciProvider without any special implementation
 /// </summary>
 /// <returns></returns>
 internal static IVsRegisterScciProvider GetBaseRegisterScciProvider()
 {
     if (registerScciProviderFactory == null)
         registerScciProviderFactory = new GenericMockFactory("RegisterScciProvider", new Type[] { typeof(IVsRegisterScciProvider) });
     IVsRegisterScciProvider registerProvider = (IVsRegisterScciProvider)registerScciProviderFactory.GetInstance();
     return registerProvider;
 }
開發者ID:jradxl,項目名稱:All-In-One-Framework-VS2012,代碼行數:11,代碼來源:MockRegisterScciProvider.cs

示例7: GetBaseFrame

 /// <summary>
 /// Return a IVsWindowFrame without any special implementation
 /// </summary>
 /// <returns></returns>
 internal static IVsWindowFrame GetBaseFrame()
 {
     if (frameFactory == null)
         frameFactory = new GenericMockFactory("WindowFrame", new Type[] { typeof(IVsWindowFrame) });
     IVsWindowFrame frame = (IVsWindowFrame)frameFactory.GetInstance();
     return frame;
 }
開發者ID:CodeMangler,項目名稱:vsgit,代碼行數:11,代碼來源:WindowFrameMock.cs

示例8: GetUiShellInstance

 /// <summary>
 /// Returns an IVsUiShell that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetUiShellInstance()
 {
     if (uiShellFactory == null)
         uiShellFactory = new GenericMockFactory("UiShell", new Type[] { typeof(IVsUIShell) });
     BaseMock uiShell = uiShellFactory.GetInstance();
     return uiShell;
 }
開發者ID:rsweeney21,項目名稱:VisualGit,代碼行數:11,代碼來源:MockUiShellProvider.cs

示例9: GetShellInstance

 /// <summary>
 /// Returns an IVsShell that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetShellInstance()
 {
     if (ShellFactory == null)
         ShellFactory = new GenericMockFactory("Shell", new Type[] { typeof(IVsShell) });
     BaseMock Shell = ShellFactory.GetInstance();
     return Shell;
 }
開發者ID:rsweeney21,項目名稱:VisualGit,代碼行數:11,代碼來源:MockShellProvider.cs

示例10: GetILocalRegistryInstance

 internal static BaseMock GetILocalRegistryInstance()
 {
     GenericMockFactory factory = new GenericMockFactory("ILocalRegistry", new Type[] { typeof(ILocalRegistry) });
     BaseMock mockObj = factory.GetInstance();
     string name = string.Format("{0}.{1}", typeof(ILocalRegistry).FullName, "CreateInstance");
     mockObj.AddMethodCallback(name, new EventHandler<CallbackArgs>(CreateInstanceCallBack));
     return mockObj;
 }
開發者ID:ZinkoSoft,項目名稱:NuSet,代碼行數:8,代碼來源:LocalRegistryServiceMock.cs

示例11: GetUiShellInstance

 internal static BaseMock GetUiShellInstance()
 {
     if (_uiShellFactory == null)
     {
         _uiShellFactory = new GenericMockFactory("UiShell", new[] { typeof(IVsUIShell), typeof(IVsUIShellOpenDocument) });
     }
     var uiShell = _uiShellFactory.GetInstance();
     return uiShell;
 }
開發者ID:duncansmart,項目名稱:TortoiseGitToolbar,代碼行數:9,代碼來源:UIShellServiceMock.cs

示例12: GetSolutionBuildManagerInstance

 /// <summary>
 /// Returns a SVsSolutionBuildManager that does not implement any methods
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetSolutionBuildManagerInstance()
 {
     if(solutionBuildManager == null)
     {
         solutionBuildManager = new GenericMockFactory("SolutionBuildManager", new Type[] { typeof(IVsSolutionBuildManager2), typeof(IVsSolutionBuildManager3) });
     }
     BaseMock buildManager = solutionBuildManager.GetInstance();
     return buildManager;
 }
開發者ID:mimura1133,項目名稱:uo_mpfproj14,代碼行數:13,代碼來源:MockServicesProvider.cs

示例13: GetUserSettingsFactoryInstance

 /// <summary>
 /// Returns an IVSUserSettings that does not implement any methods.
 /// </summary>
 /// <returns></returns>
 internal static BaseMock GetUserSettingsFactoryInstance()
 {
     if (userSettingsFactory == null)
     {
         userSettingsFactory = new GenericMockFactory("MockUserSettings", new Type[] { typeof(IVsUserSettings) });
     }
     BaseMock userSettings = userSettingsFactory.GetInstance();
     return userSettings;
 }
開發者ID:jradxl,項目名稱:All-In-One-Framework-VS2012,代碼行數:13,代碼來源:MockServiceProvider.cs

示例14: GetRegisterProjectInstance

        /// <summary>
        /// Gets an IVsRegisterProject service mock object
        /// </summary>
        /// <returns></returns>
        internal static BaseMock GetRegisterProjectInstance()
        {
            if(null == registerProjectFactory)
            {
                registerProjectFactory = new GenericMockFactory("MockRegisterProject", new Type[] { typeof(IVsRegisterProjectTypes) });
            }
            BaseMock mock = registerProjectFactory.GetInstance();

            return mock;
        }
開發者ID:ldematte,項目名稱:BlenXVSP,代碼行數:14,代碼來源:MockServicesProvider.cs

示例15: GetIVsFileChangeEx

        /// <summary>
        /// Gets an IVsFileChnageEx service mock object
        /// </summary>
        /// <returns></returns>
        internal static BaseMock GetIVsFileChangeEx()
        {
            if (null == fileChangeEx)
            {
                fileChangeEx = new GenericMockFactory("MockIVsFileChangeEx", new Type[] { typeof(IVsFileChangeEx) });
            }
            BaseMock mock = fileChangeEx.GetInstance();

            return mock;
        }
開發者ID:tunnelvisionlabs,項目名稱:MPFProj10,代碼行數:14,代碼來源:MockServicesProvider.cs


注:本文中的Microsoft.VsSDK.UnitTestLibrary.GenericMockFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。