@@ -1129,6 +1129,64 @@ public void RemoveParams_RefactorDeclaration_FailsInvalidTarget()
11291129 {
11301130 Assert . AreEqual ( "Invalid declaration type" , e . Message ) ;
11311131 }
1132+
1133+ Assert . IsTrue ( false ) ;
1134+ }
1135+
1136+ [ TestMethod ]
1137+ public void RemoveParams_PresenterIsNull ( )
1138+ {
1139+ //Input
1140+ const string inputCode =
1141+ @"Private Sub Foo()
1142+ End Sub" ;
1143+
1144+ //Arrange
1145+ var project = SetupMockProject ( inputCode ) ;
1146+ var module = project . Object . VBComponents . Item ( 0 ) . CodeModule ;
1147+ var parseResult = new RubberduckParser ( ) . Parse ( project . Object ) ;
1148+
1149+ var editor = new Mock < IActiveCodePaneEditor > ( ) ;
1150+ editor . Setup ( e => e . GetSelection ( ) ) . Returns ( ( QualifiedSelection ? ) null ) ;
1151+
1152+ var factory = new RemoveParametersPresenterFactory ( editor . Object , null ,
1153+ parseResult , null ) ;
1154+
1155+ //act
1156+ var refactoring = new RemoveParametersRefactoring ( factory ) ;
1157+ refactoring . Refactor ( ) ;
1158+
1159+ Assert . AreEqual ( inputCode , module . Lines ( ) ) ;
1160+ }
1161+
1162+ [ TestMethod ]
1163+ public void RemoveParams_ModelIsNull ( )
1164+ {
1165+ //Input
1166+ const string inputCode =
1167+ @"Private Sub Foo()
1168+ End Sub" ;
1169+ var selection = new Selection ( 1 , 23 , 1 , 27 ) ; //startLine, startCol, endLine, endCol
1170+
1171+ //Arrange
1172+ var project = SetupMockProject ( inputCode ) ;
1173+ var module = project . Object . VBComponents . Item ( 0 ) . CodeModule ;
1174+ var parseResult = new RubberduckParser ( ) . Parse ( project . Object ) ;
1175+
1176+ var qualifiedSelection = GetQualifiedSelection ( selection ) ;
1177+
1178+ //Specify Param(s) to remove
1179+ var model = new RemoveParametersModel ( parseResult , qualifiedSelection , null ) ;
1180+
1181+ //SetupFactory
1182+ var factory = SetupFactory ( model ) ;
1183+
1184+ //Act
1185+ var refactoring = new RemoveParametersRefactoring ( factory . Object ) ;
1186+ refactoring . Refactor ( qualifiedSelection ) ;
1187+
1188+ //Assert
1189+ Assert . AreEqual ( inputCode , module . Lines ( ) ) ;
11321190 }
11331191
11341192 [ TestMethod ]
0 commit comments