Skip to content

Commit ae44722

Browse files
committed
Fix tests and add resx resource
1 parent 5582c1c commit ae44722

File tree

4 files changed

+44
-18
lines changed

4 files changed

+44
-18
lines changed

Rubberduck.Parsing/Inspections/Resources/InspectionsUI1.Designer.cs renamed to Rubberduck.Parsing/Inspections/Resources/InspectionsUI.Designer.cs

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Parsing/Inspections/Resources/InspectionsUI.resx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -887,4 +887,7 @@ If the parameter can be null, ignore this inspection result; passing a null valu
887887
<data name="EmptyModuleInspectionResultFormat" xml:space="preserve">
888888
<value>Module/class {0} is empty.</value>
889889
</data>
890-
</root>
890+
<data name="ObsoleteErrorSyntaxInspectionName" xml:space="preserve">
891+
<value>Use of obsolete 'Error' statement</value>
892+
</data>
893+
</root>

Rubberduck.Parsing/Rubberduck.Parsing.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@
155155
<Compile Include="Inspections\Abstract\IInspector.cs" />
156156
<Compile Include="Inspections\Abstract\IParseTreeInspection.cs" />
157157
<Compile Include="Inspections\Abstract\IQuickFix.cs" />
158+
<Compile Include="Inspections\Resources\InspectionsUI.Designer.cs">
159+
<AutoGen>True</AutoGen>
160+
<DesignTime>True</DesignTime>
161+
<DependentUpon>InspectionsUI.resx</DependentUpon>
162+
</Compile>
158163
<Compile Include="Symbols\ParsingExceptions\MainParseExceptionErrorListener.cs" />
159164
<Compile Include="Symbols\ParsingExceptions\PreprocessorExceptionErrorListener.cs" />
160165
<Compile Include="Symbols\ParsingExceptions\ParsePassExceptionErrorListener.cs" />
@@ -177,11 +182,6 @@
177182
<AutoGen>True</AutoGen>
178183
<DesignTime>True</DesignTime>
179184
</Compile>
180-
<Compile Include="Inspections\Resources\InspectionsUI1.Designer.cs">
181-
<AutoGen>True</AutoGen>
182-
<DesignTime>True</DesignTime>
183-
<DependentUpon>InspectionsUI.resx</DependentUpon>
184-
</Compile>
185185
<Compile Include="Rewriter\MemberAttributesRewriter.cs" />
186186
<Compile Include="Rewriter\RewriterInfo\ConstantRewriterInfoFinder.cs" />
187187
<Compile Include="Rewriter\RewriterInfo\DefaultRewriterInfoFinder.cs" />
@@ -471,7 +471,7 @@
471471
<EmbeddedResource Include="Inspections\Resources\InspectionsUI.resx">
472472
<Generator>PublicResXFileCodeGenerator</Generator>
473473
<SubType>Designer</SubType>
474-
<LastGenOutput>InspectionsUI1.Designer.cs</LastGenOutput>
474+
<LastGenOutput>InspectionsUI.Designer.cs</LastGenOutput>
475475
</EmbeddedResource>
476476
<EmbeddedResource Include="ParsingText.de.resx" />
477477
<EmbeddedResource Include="ParsingText.fr.resx" />

RubberduckTests/Inspections/GeneralInspectionTests.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,30 @@ public void InitResources()
2424
RubberduckUI.Culture = Thread.CurrentThread.CurrentUICulture;
2525
}
2626

27+
private static List<Type> GetAllBaseTypes(Type type)
28+
{
29+
var baseTypes = new List<Type>();
30+
31+
var baseType = type.BaseType;
32+
while (baseType != null)
33+
{
34+
baseTypes.Add(baseType);
35+
baseType = baseType.BaseType;
36+
}
37+
38+
return baseTypes;
39+
}
40+
2741
[TestMethod]
2842
[TestCategory("Inspections")]
2943
public void InspectionNameStringsExist()
3044
{
3145
var inspections = typeof(InspectionBase).Assembly.GetTypes()
32-
.Where(type => type.BaseType == typeof(InspectionBase) && !type.IsAbstract)
33-
.Where(i => string.IsNullOrEmpty(InspectionsUI.ResourceManager.GetString(i.Name + "Name")))
46+
.Where(type => GetAllBaseTypes(type).Contains(typeof(InspectionBase)) && !type.IsAbstract)
47+
.Where(i => string.IsNullOrWhiteSpace(InspectionsUI.ResourceManager.GetString(i.Name + "Name")))
3448
.Select(i => i.Name)
3549
.ToList();
36-
50+
3751
Assert.IsFalse(inspections.Any(), string.Join(Environment.NewLine, inspections));
3852
}
3953

@@ -42,7 +56,7 @@ public void InspectionNameStringsExist()
4256
public void InspectionMetaStringsExist()
4357
{
4458
var inspections = typeof(InspectionBase).Assembly.GetTypes()
45-
.Where(type => type.BaseType == typeof(InspectionBase) && !type.IsAbstract)
59+
.Where(type => GetAllBaseTypes(type).Contains(typeof(InspectionBase)) && !type.IsAbstract)
4660
.Where(i => string.IsNullOrEmpty(InspectionsUI.ResourceManager.GetString(i.Name + "Meta")))
4761
.Select(i => i.Name)
4862
.ToList();
@@ -67,7 +81,7 @@ public void InspectionResultFormatStringsExist()
6781
};
6882

6983
var inspections = typeof(InspectionBase).Assembly.GetTypes()
70-
.Where(type => type.BaseType == typeof(InspectionBase) && !type.IsAbstract)
84+
.Where(type => GetAllBaseTypes(type).Contains(typeof(InspectionBase)) && !type.IsAbstract)
7185
.Where(i => !inspectionsWithSharedResultFormat.Contains(i.Name) &&
7286
string.IsNullOrEmpty(InspectionsUI.ResourceManager.GetString(i.Name + "ResultFormat")))
7387
.Select(i => i.Name)
@@ -81,7 +95,7 @@ public void InspectionResultFormatStringsExist()
8195
public void InspectionNameStrings_AreNotFormatted()
8296
{
8397
var inspections = typeof(InspectionBase).Assembly.GetTypes()
84-
.Where(type => type.BaseType == typeof(InspectionBase))
98+
.Where(type => GetAllBaseTypes(type).Contains(typeof(InspectionBase)))
8599
.Where(i =>
86100
{
87101
var value = InspectionsUI.ResourceManager.GetString(i.Name + "Name");

0 commit comments

Comments
 (0)