当前位置: 首页>>代码示例>>C#>>正文


C# MockVbeBuilder.Build方法代码示例

本文整理汇总了C#中RubberduckTests.Mocks.MockVbeBuilder.Build方法的典型用法代码示例。如果您正苦于以下问题:C# MockVbeBuilder.Build方法的具体用法?C# MockVbeBuilder.Build怎么用?C# MockVbeBuilder.Build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RubberduckTests.Mocks.MockVbeBuilder的用法示例。


在下文中一共展示了MockVbeBuilder.Build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Resolve

        private RubberduckParserState Resolve(params Tuple<string,vbext_ComponentType>[] components)
        {
            var builder = new MockVbeBuilder();
            var projectBuilder = builder.ProjectBuilder("TestProject", vbext_ProjectProtection.vbext_pp_none);
            for (var i = 0; i < components.Length; i++)
            {
                projectBuilder.AddComponent("Component" + (i + 1), components[i].Item2, components[i].Item1);
            }

            var project = projectBuilder.Build();
            builder.AddProject(project);
            var vbe = builder.Build();

            var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

            parser.Parse();
            if (parser.State.Status != ParserState.Ready)
            {
                Assert.Inconclusive("Parser state should be 'Ready', but returns '{0}'.", parser.State.Status);
            }

            return parser.State;
        }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:23,代码来源:ResolverTests.cs

示例2: Presenter_NullTargetReturnsNullModel

        public void Presenter_NullTargetReturnsNullModel()
        {
            //Input
            const string inputCode =
@"
Private Sub Foo(ByVal arg1 As Integer, ByVal arg2 As String)
End Sub";
            var selection = Selection.Home;

            //Arrange
            var builder = new MockVbeBuilder();
            var projectBuilder = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none);
            projectBuilder.AddComponent("Module1", vbext_ComponentType.vbext_ct_StdModule, inputCode);
            var project = projectBuilder.Build();
            builder.AddProject(project);
            var vbe = builder.Build();

            var codePaneFactory = new CodePaneWrapperFactory();
            var mockHost = new Mock<IHostApplication>();
            mockHost.SetupAllProperties();
            var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

            parser.Parse();
            if (parser.State.Status == ParserState.Error) { Assert.Inconclusive("Parser Error"); }

            var codePane = project.Object.VBComponents.Item(0).CodeModule.CodePane;
            var ext = codePaneFactory.Create(codePane);
            ext.Selection = selection;

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(codePane.CodeModule.Parent), selection);

            var editor = new Mock<IActiveCodePaneEditor>();
            editor.Setup(e => e.GetSelection()).Returns(qualifiedSelection);

            var factory = new EncapsulateFieldPresenterFactory(parser.State, editor.Object, null);

            var presenter = factory.Create();

            Assert.AreEqual(null, presenter.Show());
        }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:40,代码来源:EncapsulateFieldTests.cs

示例3: Factory_NullSelectionReturnsNullPresenter

        public void Factory_NullSelectionReturnsNullPresenter()
        {
            //Input
            const string inputCode =
@"Private fizz As Integer";

            //Arrange
            var builder = new MockVbeBuilder();
            var projectBuilder = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none);
            projectBuilder.AddComponent("Module1", vbext_ComponentType.vbext_ct_StdModule, inputCode);
            var project = projectBuilder.Build();
            builder.AddProject(project);
            var vbe = builder.Build();

            var mockHost = new Mock<IHostApplication>();
            mockHost.SetupAllProperties();
            var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

            parser.Parse();
            if (parser.State.Status == ParserState.Error) { Assert.Inconclusive("Parser Error"); }

            var editor = new Mock<IActiveCodePaneEditor>();
            editor.Setup(e => e.GetSelection()).Returns((QualifiedSelection?)null);

            var factory = new EncapsulateFieldPresenterFactory(parser.State, editor.Object, null);

            Assert.AreEqual(null, factory.Create());
        }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:28,代码来源:EncapsulateFieldTests.cs


注:本文中的RubberduckTests.Mocks.MockVbeBuilder.Build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。