public void RemoveParameters_CanExecute_NullActiveCodePane()
        {
            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(string.Empty, out _);

            vbe.Setup(v => v.ActiveCodePane).Returns((ICodePane)null);
            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null, rewritingManager);
                Assert.IsFalse(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_NullActiveCodePane()
        {
            IVBComponent component;
            var          vbe = MockVbeBuilder.BuildFromSingleStandardModule(string.Empty, out component);

            vbe.Setup(v => v.ActiveCodePane).Returns((ICodePane)null);
            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);
                Assert.IsFalse(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_NonReadyState()
        {
            IVBComponent component;
            var          vbe = MockVbeBuilder.BuildFromSingleStandardModule(string.Empty, out component);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                state.SetStatusAndFireStateChanged(this, ParserState.ResolvedDeclarations, CancellationToken.None);

                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);
                Assert.IsFalse(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_Event_OneParam()
        {
            const string input =
                @"Public Event Foo(value)";

            IVBComponent component;
            var          vbe   = MockVbeBuilder.BuildFromSingleStandardModule(input, out component, new Selection(1, 16, 1, 16));
            var          state = MockParser.CreateAndParse(vbe.Object);

            var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);

            Assert.IsTrue(removeParametersCommand.CanExecute(null));
        }
        public void RemoveParameters_CanExecute_Event_OneParam()
        {
            const string input =
                @"Public Event Foo(value)";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out _, new Selection(1, 16, 1, 16));

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null, rewritingManager);
                Assert.IsTrue(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_PropertySet_TwoParams()
        {
            var input =
                @"Property Set foo(value1, value2)
End Property";

            IVBComponent component;
            var          vbe   = MockVbeBuilder.BuildFromSingleStandardModule(input, out component, new Selection(1, 16, 1, 16));
            var          state = MockParser.CreateAndParse(vbe.Object);

            var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);

            Assert.IsTrue(removeParametersCommand.CanExecute(null));
        }
        public void RemoveParameters_CanExecute_Function_OneParam()
        {
            var input =
                @"Function foo(value) As Integer
End Function";

            IVBComponent component;
            var          vbe   = MockVbeBuilder.BuildFromSingleStandardModule(input, out component, new Selection(1, 11, 1, 11));
            var          state = MockParser.CreateAndParse(vbe.Object);

            var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);

            Assert.IsTrue(removeParametersCommand.CanExecute(null));
        }
        public void RemoveParameters_CanExecute_Proc_NoParams()
        {
            var input =
                @"Sub foo()
End Sub";

            IVBComponent component;
            var          vbe   = MockVbeBuilder.BuildFromSingleStandardModule(input, out component, new Selection(1, 6, 1, 6));
            var          state = MockParser.CreateAndParse(vbe.Object);

            var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null);

            Assert.IsFalse(removeParametersCommand.CanExecute(null));
        }
        public void RemoveParameters_CanExecute_PropertySet_TwoParams()
        {
            var input =
                @"Property Set foo(value1, value2)
End Property";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out _, new Selection(1, 16, 1, 16));

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null, rewritingManager);
                Assert.IsTrue(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_Function_OneParam()
        {
            var input =
                @"Function foo(value) As Integer
End Function";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out _, new Selection(1, 11, 1, 11));

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null, rewritingManager);
                Assert.IsTrue(removeParametersCommand.CanExecute(null));
            }
        }
        public void RemoveParameters_CanExecute_Proc_NoParams()
        {
            var input =
                @"Sub foo()
End Sub";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out _, new Selection(1, 6, 1, 6));

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var removeParametersCommand = new RefactorRemoveParametersCommand(vbe.Object, state, null, rewritingManager);
                Assert.IsFalse(removeParametersCommand.CanExecute(null));
            }
        }
 public RefactorRemoveParametersCommandMenuItem(RefactorRemoveParametersCommand command) : base(command)
 {
 }