Skip to content

Commit ecdd638

Browse files
committed
Added OneTime setup and teardown
This inspection needed to modify the default project and module names used by the InspectionTestsBase
1 parent 99188cc commit ecdd638

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

RubberduckTests/Inspections/UseMeaningfulNameInspectionTests.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
43
using Moq;
54
using Rubberduck.Inspections.Concrete;
6-
using Rubberduck.Parsing.Symbols;
7-
using Rubberduck.Settings;
85
using Rubberduck.SettingsProvider;
96
using Rubberduck.VBEditor.SafeComWrappers;
107
using RubberduckTests.Mocks;
@@ -17,11 +14,28 @@ namespace RubberduckTests.Inspections
1714
[TestFixture]
1815
public class UseMeaningfulNameInspectionTests : InspectionTestsBase
1916
{
20-
public UseMeaningfulNameInspectionTests()
17+
private string _initialDefaultProjectName;
18+
private string _initialDefaultModuleName;
19+
20+
//(10/15/2019)The default MockVbeBuilder default identifiers "TestProject1" and "TestModule1"
21+
//are flagged by this inspection and interfere with the intended test results.
22+
//Modify these static property values during setup to remove the unintended results.
23+
//Reset the values during teardown to prevent failure of subsequent test classes using the
24+
//default names during setup or expected vs actual asserts.
25+
[OneTimeSetUp]
26+
public void CacheDefaultNames()
2127
{
22-
//The default InspectionTestsBase names are flag as meaningless names (end with a number)
23-
TestProjectName = "VBAProject";
24-
TestModuleName = "TestModule";
28+
_initialDefaultProjectName = MockVbeBuilder.TestProjectName;
29+
_initialDefaultModuleName = MockVbeBuilder.TestModuleName;
30+
MockVbeBuilder.TestProjectName = "VBAProject";
31+
MockVbeBuilder.TestModuleName = "TestModule";
32+
}
33+
34+
[OneTimeTearDown]
35+
public void RestoreDefaultIdentifiers()
36+
{
37+
MockVbeBuilder.TestProjectName = _initialDefaultProjectName;
38+
MockVbeBuilder.TestModuleName = _initialDefaultModuleName;
2539
}
2640

2741
[Test]

0 commit comments

Comments
 (0)