当前位置: 首页>>代码示例>>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;未经允许,请勿转载。