|
2 | 2 | using System.Threading;
|
3 | 3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
4 | 4 | using Rubberduck.Inspections.Concrete;
|
5 |
| -using Rubberduck.Inspections.QuickFixes; |
6 | 5 | using Rubberduck.Parsing.Inspections.Resources;
|
7 | 6 | using Rubberduck.Parsing.VBA;
|
8 | 7 | using Rubberduck.VBEditor.SafeComWrappers;
|
@@ -174,121 +173,6 @@ Property Let Foo(value)
|
174 | 173 | Assert.IsFalse(inspectionResults.Any());
|
175 | 174 | }
|
176 | 175 |
|
177 |
| - [TestMethod] |
178 |
| - [TestCategory("Inspections")] |
179 |
| - public void WriteOnlyProperty_AddPropertyGetQuickFixWorks_ImplicitTypesAndAccessibility() |
180 |
| - { |
181 |
| - const string inputCode = |
182 |
| -@"Property Let Foo(value) |
183 |
| -End Property"; |
184 |
| - |
185 |
| - const string expectedCode = |
186 |
| -@"Public Property Get Foo() As Variant |
187 |
| -End Property |
188 |
| -
|
189 |
| -Property Let Foo(value) |
190 |
| -End Property"; |
191 |
| - |
192 |
| - |
193 |
| - IVBComponent component; |
194 |
| - var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out component); |
195 |
| - |
196 |
| - var state = MockParser.CreateAndParse(vbe.Object); |
197 |
| - |
198 |
| - var inspection = new WriteOnlyPropertyInspection(state); |
199 |
| - var inspectionResults = inspection.GetInspectionResults(); |
200 |
| - |
201 |
| - new WriteOnlyPropertyQuickFix(state).Fix(inspectionResults.First()); |
202 |
| - Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); |
203 |
| - } |
204 |
| - |
205 |
| - [TestMethod] |
206 |
| - [TestCategory("Inspections")] |
207 |
| - public void WriteOnlyProperty_AddPropertyGetQuickFixWorks_ExlicitTypesAndAccessibility() |
208 |
| - { |
209 |
| - const string inputCode = |
210 |
| -@"Public Property Let Foo(ByVal value As Integer) |
211 |
| -End Property"; |
212 |
| - |
213 |
| - const string expectedCode = |
214 |
| -@"Public Property Get Foo() As Integer |
215 |
| -End Property |
216 |
| -
|
217 |
| -Public Property Let Foo(ByVal value As Integer) |
218 |
| -End Property"; |
219 |
| - |
220 |
| - IVBComponent component; |
221 |
| - var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out component); |
222 |
| - |
223 |
| - var state = MockParser.CreateAndParse(vbe.Object); |
224 |
| - |
225 |
| - var inspection = new WriteOnlyPropertyInspection(state); |
226 |
| - var inspectionResults = inspection.GetInspectionResults(); |
227 |
| - |
228 |
| - new WriteOnlyPropertyQuickFix(state).Fix(inspectionResults.First()); |
229 |
| - Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); |
230 |
| - } |
231 |
| - |
232 |
| - [TestMethod] |
233 |
| - [TestCategory("Inspections")] |
234 |
| - public void WriteOnlyProperty_AddPropertyGetQuickFixWorks_MultipleParams() |
235 |
| - { |
236 |
| - const string inputCode = |
237 |
| -@"Public Property Let Foo(value1, ByVal value2 As Integer, ByRef value3 As Long, value4 As Date, ByVal value5, value6 As String) |
238 |
| -End Property"; |
239 |
| - |
240 |
| - const string expectedCode = |
241 |
| -@"Public Property Get Foo(ByRef value1 As Variant, ByVal value2 As Integer, ByRef value3 As Long, ByRef value4 As Date, ByVal value5 As Variant) As String |
242 |
| -End Property |
243 |
| -
|
244 |
| -Public Property Let Foo(value1, ByVal value2 As Integer, ByRef value3 As Long, value4 As Date, ByVal value5, value6 As String) |
245 |
| -End Property"; |
246 |
| - |
247 |
| - IVBComponent component; |
248 |
| - var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out component); |
249 |
| - |
250 |
| - var state = MockParser.CreateAndParse(vbe.Object); |
251 |
| - |
252 |
| - var inspection = new WriteOnlyPropertyInspection(state); |
253 |
| - var inspectionResults = inspection.GetInspectionResults(); |
254 |
| - |
255 |
| - new WriteOnlyPropertyQuickFix(state).Fix(inspectionResults.First()); |
256 |
| - Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); |
257 |
| - } |
258 |
| - |
259 |
| - [TestMethod] |
260 |
| - [TestCategory("Inspections")] |
261 |
| - public void WriteOnlyProperty_IgnoreQuickFixWorks() |
262 |
| - { |
263 |
| - const string inputCode = |
264 |
| -@"Property Let Foo(value) |
265 |
| -End Property"; |
266 |
| - |
267 |
| - const string expectedCode = |
268 |
| -@"'@Ignore WriteOnlyProperty |
269 |
| -Property Let Foo(value) |
270 |
| -End Property"; |
271 |
| - |
272 |
| - var builder = new MockVbeBuilder(); |
273 |
| - var project = builder.ProjectBuilder("VBAProject", ProjectProtection.Unprotected) |
274 |
| - .AddComponent("MyClass", ComponentType.ClassModule, inputCode) |
275 |
| - .Build(); |
276 |
| - var component = project.Object.VBComponents[0]; |
277 |
| - var vbe = builder.AddProject(project).Build(); |
278 |
| - |
279 |
| - var parser = MockParser.Create(vbe.Object); |
280 |
| - |
281 |
| - parser.Parse(new CancellationTokenSource()); |
282 |
| - if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); } |
283 |
| - |
284 |
| - var inspection = new WriteOnlyPropertyInspection(parser.State); |
285 |
| - var inspectionResults = inspection.GetInspectionResults(); |
286 |
| - |
287 |
| - new IgnoreOnceQuickFix(parser.State, new[] {inspection}).Fix(inspectionResults.First()); |
288 |
| - |
289 |
| - Assert.AreEqual(expectedCode, parser.State.GetRewriter(component).GetText()); |
290 |
| - } |
291 |
| - |
292 | 176 | [TestMethod]
|
293 | 177 | [TestCategory("Inspections")]
|
294 | 178 | public void InspectionType()
|
|
0 commit comments