Skip to content

Commit 94cb26c

Browse files
committed
Switch AvoidContentManagerBadType to rely on DataLoader
1 parent 9a32240 commit 94cb26c

9 files changed

Lines changed: 35 additions & 679 deletions

File tree

src/SMAPI.ModBuildConfig.Analyzer.DataGeneration/Program.cs

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/SMAPI.ModBuildConfig.Analyzer.DataGeneration/SMAPI.ModBuildConfig.Analyzer.DataGeneration.csproj

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/SMAPI.ModBuildConfig.Analyzer.Tests/ContentManagerAnalyzerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void EmptyCode_HasNoDiagnostics()
8282
/// <param name="expression">The expression which should be reported.</param>
8383
/// <param name="netType">The net type name which should be reported.</param>
8484
/// <param name="suggestedProperty">The suggested property name which should be reported.</param>
85-
[TestCase("Game1.content.Load<Dictionary<int, string>>(\"Data\\\\Fish\");", 0, "Data\\Fish", "System.Collections.Generic.Dictionary<System.Int32,System.String>", "System.Collections.Generic.Dictionary<System.String,System.String>")]
85+
[TestCase("Game1.content.Load<Dictionary<int, string>>(\"Data\\\\Fish\");", 0, "Data\\Fish", "System.Collections.Generic.Dictionary<int, string>", "System.Collections.Generic.Dictionary<string, string>")]
8686
public void BadType_RaisesDiagnostic(string codeText, int column, string assetName, string expectedType, string suggestedType)
8787
{
8888
// arrange
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// ReSharper disable CheckNamespace, InconsistentNaming -- matches Stardew Valley's code
2+
// ReSharper disable UnusedMember.Global -- used dynamically for unit tests
3+
using System.Collections.Generic;
4+
5+
namespace StardewValley
6+
{
7+
/// <summary>A simplified version of Stardew Valley's <c>StardewValley.DataLoader</c> class for unit testing.</summary>
8+
public static class DataLoader
9+
{
10+
public static Dictionary<string, string> Fish(LocalizedContentManager content)
11+
{
12+
return default!;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)