本文整理汇总了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;
}
示例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());
}
示例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());
}