Ejemplo n.º 1
0
        public void Presenter_NullTarget_ReturnsNull()
        {
            //Input
            const string inputCode =
                @"Public Sub Foo(ByVal arg1 As Integer, ByVal arg2 As String)
End Sub";
            var selection = new Selection(1, 15, 1, 15);

            //Arrange
            var         builder = new MockVbeBuilder();
            VBComponent component;
            var         vbe      = builder.BuildFromSingleStandardModule(inputCode, out component, selection);
            var         mockHost = new Mock <IHostApplication>();

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

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

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);

            var model = new ExtractInterfaceModel(parser.State, qualifiedSelection);

            var view      = new Mock <IExtractInterfaceDialog>();
            var presenter = new ExtractInterfacePresenter(view.Object, model);

            Assert.AreEqual(null, presenter.Show());
        }
Ejemplo n.º 2
0
        public void Presenter_NullTarget_ReturnsNull()
        {
            //Input
            const string inputCode =
                @"Public Sub Foo(ByVal arg1 As Integer, ByVal arg2 As String)
End Sub";
            var selection = new Selection(1, 15, 1, 15);

            IVBComponent component;
            var          vbe   = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out component, selection);
            var          state = MockParser.CreateAndParse(vbe.Object);

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);

            var model = new ExtractInterfaceModel(state, qualifiedSelection);

            var view      = new Mock <IExtractInterfaceDialog>();
            var presenter = new ExtractInterfacePresenter(view.Object, model);

            Assert.AreEqual(null, presenter.Show());
        }