1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Globalization ;
3
4
using System . Linq ;
5
+ using System . Threading ;
4
6
using Microsoft . VisualStudio . TestTools . UnitTesting ;
5
7
using Rubberduck . Inspections ;
8
+ using Rubberduck . UI ;
6
9
7
10
namespace RubberduckTests . Inspections
8
11
{
9
12
[ TestClass ]
10
13
public class GeneralInspectionTests
11
14
{
15
+ [ TestInitialize ]
16
+ public void InitResources ( )
17
+ {
18
+ // ensure resources are using an invariant culture.
19
+ Thread . CurrentThread . CurrentCulture = CultureInfo . InvariantCulture ;
20
+ Thread . CurrentThread . CurrentUICulture = Thread . CurrentThread . CurrentCulture ;
21
+ InspectionsUI . Culture = Thread . CurrentThread . CurrentUICulture ;
22
+ RubberduckUI . Culture = Thread . CurrentThread . CurrentUICulture ;
23
+ }
24
+
12
25
[ TestMethod ]
13
26
public void InspectionNameStringsExist ( )
14
27
{
15
28
var inspections = typeof ( InspectionBase ) . Assembly . GetTypes ( )
16
29
. Where ( type => type . BaseType == typeof ( InspectionBase ) )
17
30
. Where ( i => string . IsNullOrEmpty ( InspectionsUI . ResourceManager . GetString ( i . Name + "Name" ) ) )
18
- . Select ( i => i . Name ) ;
31
+ . Select ( i => i . Name )
32
+ . ToList ( ) ;
19
33
20
34
Assert . IsFalse ( inspections . Any ( ) , string . Join ( Environment . NewLine , inspections ) ) ;
21
35
}
@@ -26,7 +40,8 @@ public void InspectionMetaStringsExist()
26
40
var inspections = typeof ( InspectionBase ) . Assembly . GetTypes ( )
27
41
. Where ( type => type . BaseType == typeof ( InspectionBase ) )
28
42
. Where ( i => string . IsNullOrEmpty ( InspectionsUI . ResourceManager . GetString ( i . Name + "Meta" ) ) )
29
- . Select ( i => i . Name ) ;
43
+ . Select ( i => i . Name )
44
+ . ToList ( ) ;
30
45
31
46
Assert . IsFalse ( inspections . Any ( ) , string . Join ( Environment . NewLine , inspections ) ) ;
32
47
}
@@ -46,7 +61,8 @@ public void InspectionResultFormatStringsExist()
46
61
. Where ( type => type . BaseType == typeof ( InspectionBase ) )
47
62
. Where ( i => ! inspectionsWithSharedResultFormat . Contains ( i . Name ) &&
48
63
string . IsNullOrEmpty ( InspectionsUI . ResourceManager . GetString ( i . Name + "ResultFormat" ) ) )
49
- . Select ( i => i . Name ) ;
64
+ . Select ( i => i . Name )
65
+ . ToList ( ) ;
50
66
51
67
Assert . IsFalse ( inspections . Any ( ) , string . Join ( Environment . NewLine , inspections ) ) ;
52
68
}
@@ -61,7 +77,8 @@ public void InspectionNameStrings_AreNotFormatted()
61
77
var value = InspectionsUI . ResourceManager . GetString ( i . Name + "Name" ) ;
62
78
return ! string . IsNullOrEmpty ( value ) && value . Contains ( "{0}" ) ;
63
79
} )
64
- . Select ( i => i . Name ) ;
80
+ . Select ( i => i . Name )
81
+ . ToList ( ) ;
65
82
66
83
Assert . IsFalse ( inspections . Any ( ) , string . Join ( Environment . NewLine , inspections ) ) ;
67
84
}
0 commit comments