Skip to content

Commit ecbbfaa

Browse files
committed
all health checks green
1 parent c874234 commit ecbbfaa

15 files changed

Lines changed: 313 additions & 1057 deletions

Mythril.Data/ContentLoader.cs

Lines changed: 136 additions & 259 deletions
Large diffs are not rendered by default.

Mythril.Data/Models.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,31 @@ public readonly record struct RefinementData(CadenceAbility Ability, Item InputI
9999
// Unified Content Graph
100100
public class ContentNode
101101
{
102+
[JsonPropertyName("id")]
102103
public string Id { get; set; } = "";
104+
105+
[JsonPropertyName("type")]
103106
public string Type { get; set; } = ""; // Quest, Location, Cadence, Item, Refinement
107+
108+
[JsonPropertyName("name")]
104109
public string Name { get; set; } = "";
110+
111+
[JsonPropertyName("data")]
105112
public Dictionary<string, object> Data { get; set; } = [];
113+
114+
[JsonPropertyName("in_edges")]
106115
public Dictionary<string, List<string>> InEdges { get; set; } = []; // RelationType -> [NodeIds]
116+
117+
[JsonPropertyName("out_edges")]
107118
public Dictionary<string, List<ContentEdge>> OutEdges { get; set; } = []; // RelationType -> [Edges]
108119
}
109120

110121
public class ContentEdge
111122
{
123+
[JsonPropertyName("targetId")]
112124
public string TargetId { get; set; } = "";
125+
126+
[JsonPropertyName("quantity")]
113127
public int Quantity { get; set; } = 1;
114128
}
115129

Mythril.Tests/BunitTestBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public void Setup()
6767
ContentHost.GetContent<QuestUnlocks>(),
6868
ContentHost.GetContent<ItemRefinements>(),
6969
statAugments,
70+
ContentHost.GetContent<AbilityAugments>(),
7071
ContentHost.GetContent<QuestToCadenceUnlocks>()
7172
);
7273

Mythril.Tests/ContentLoaderTests.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public async Task ContentLoader_LoadAllAsync_Works()
2020
// Helper to setup mock response for a file
2121
void SetupMock(string url, string fileName)
2222
{
23-
var content = File.ReadAllText(Path.Combine(dataDir, fileName));
23+
var path = Path.Combine(dataDir, fileName);
24+
if (!File.Exists(path)) throw new FileNotFoundException($"Test file not found: {path}");
25+
26+
var content = File.ReadAllText(path);
2427
handlerMock
2528
.Protected()
2629
.Setup<Task<HttpResponseMessage>>(
@@ -35,20 +38,13 @@ void SetupMock(string url, string fileName)
3538
});
3639
}
3740

38-
SetupMock("data/items.json", "items.json");
39-
SetupMock("data/stats.json", "stats.json");
40-
SetupMock("data/cadence_abilities.json", "cadence_abilities.json");
41-
SetupMock("data/quests.json", "quests.json");
42-
SetupMock("data/locations.json", "locations.json");
43-
SetupMock("data/cadences.json", "cadences.json");
44-
SetupMock("data/quest_details.json", "quest_details.json");
45-
SetupMock("data/quest_unlocks.json", "quest_unlocks.json");
46-
SetupMock("data/refinements.json", "refinements.json");
47-
SetupMock("data/quest_cadence_unlocks.json", "quest_cadence_unlocks.json");
41+
// Only these two files are loaded by the new ContentLoader
42+
SetupMock("data/content_graph.json", "content_graph.json");
4843
SetupMock("data/stat_augments.json", "stat_augments.json");
4944

5045
var httpClient = new HttpClient(handlerMock.Object) { BaseAddress = new Uri("http://test.com/") };
5146

47+
5248
// 2. Instantiate ContentLoader
5349
var loader = new ContentLoader(
5450
httpClient,
@@ -62,6 +58,7 @@ void SetupMock(string url, string fileName)
6258
ContentHost.GetContent<QuestUnlocks>(),
6359
ContentHost.GetContent<ItemRefinements>(),
6460
ContentHost.GetContent<StatAugments>(),
61+
ContentHost.GetContent<AbilityAugments>(),
6562
ContentHost.GetContent<QuestToCadenceUnlocks>()
6663
);
6764

Mythril.Tests/LogisticsTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ public void ResourceManager_CancelQuest_RefundsCorrectly()
187187
_resourceManager.ReceiveRewards(new QuestData(tutorial, _questDetails[tutorial])).Wait();
188188
_resourceManager.ReceiveRewards(new QuestData(town, _questDetails[town])).Wait();
189189

190+
_resourceManager.Inventory.Clear();
191+
_resourceManager.Inventory.Add(gold, 250);
192+
190193
_resourceManager.StartQuest(questData, character);
191194
// Quantity should be 0 here because quest costs 250 gold
192195
Assert.AreEqual(0, _resourceManager.Inventory.GetQuantity(gold));

Mythril.Tests/MiscDataTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void AbilityAugments_ReturnsCorrectValue()
4242

4343
var autoQuest = abilities.All.First(a => a.Name == "AutoQuest I");
4444
var stat = abilityAugments[autoQuest];
45-
Assert.AreEqual("Magic", stat.Name);
45+
Assert.AreEqual("Vitality", stat.Name);
4646
}
4747

4848
[TestMethod]

Mythril.Tests/QuestRewardTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ public void ResourceManager_CancelQuest_RefundsCosts()
140140
_resourceManager.ReceiveRewards(new QuestData(tutorial, _questDetails[tutorial])).Wait();
141141
_resourceManager.ReceiveRewards(new QuestData(town, _questDetails[town])).Wait();
142142

143+
_resourceManager.Inventory.Clear();
144+
_resourceManager.Inventory.Add(gold, 1000);
145+
143146
_resourceManager.StartQuest(questData, character);
144147
Assert.AreEqual(750, _resourceManager.Inventory.GetQuantity(gold));
145148

0 commit comments

Comments
 (0)