-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
263 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.IO; | ||
using HearthDb.Enums; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace HearthDb.Tests | ||
{ | ||
[TestClass] | ||
public class CardDefsLoadTest | ||
{ | ||
[TestInitialize] | ||
public void Init() | ||
{ | ||
Cards.ClearData(); | ||
} | ||
|
||
[TestCleanup] | ||
public void Cleanup() | ||
{ | ||
Cards.LoadBaseData(); | ||
} | ||
|
||
[TestMethod] | ||
public void LoadCards_CorrectlyAssemblesData() | ||
{ | ||
var changedCalls = 0; | ||
Cards.CardsChanged += () => changedCalls++; | ||
|
||
using var fsBase = File.OpenRead("Data/TestCardDefs.base.xml"); | ||
Cards.LoadBaseData(fsBase); | ||
|
||
Assert.AreEqual(1, changedCalls); | ||
Assert.AreEqual("Nutthapon Petchthai", Cards.All["AT_001"].ArtistName); | ||
Assert.AreEqual("Flame Lance", Cards.All["AT_001"].GetLocName(Locale.enUS)); | ||
Assert.AreEqual(null, Cards.All["AT_001"].GetLocName(Locale.deDE)); | ||
|
||
using var fsLocDe = File.OpenRead("Data/TestCardDefs.deDE.xml"); | ||
Cards.LoadLocaleData(fsLocDe, Locale.deDE); | ||
|
||
Assert.AreEqual(2, changedCalls); | ||
Assert.AreEqual("Nutthapon Petchthai", Cards.All["AT_001"].ArtistName); | ||
Assert.AreEqual("Flame Lance", Cards.All["AT_001"].GetLocName(Locale.enUS)); | ||
Assert.AreEqual("Flammenlanze", Cards.All["AT_001"].GetLocName(Locale.deDE)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<CardDefs build="212197"> | ||
<Entity CardID="AT_001" ID="2539" version="2"> | ||
<Tag enumID="185" name="CARDNAME" type="LocString"> | ||
<enUS>Flame Lance</enUS> | ||
</Tag> | ||
<Tag enumID="184" name="CARDTEXT" type="LocString"> | ||
<enUS>Deal $25 damage | ||
to a minion.</enUS> | ||
</Tag> | ||
<Tag enumID="351" name="FLAVORTEXT" type="LocString"> | ||
<enUS>It's on the rack next to ice lance, acid lance, and English muffin lance.</enUS> | ||
</Tag> | ||
<Tag enumID="342" name="ARTISTNAME" type="String">Nutthapon Petchthai</Tag> | ||
<Tag enumID="48" name="COST" type="Int" value="5"/> | ||
<Tag enumID="183" name="CARD_SET" type="Int" value="15"/> | ||
<Tag enumID="199" name="CLASS" type="Int" value="4"/> | ||
<Tag enumID="202" name="CARDTYPE" type="Int" value="5"/> | ||
<Tag enumID="203" name="RARITY" type="Int" value="1"/> | ||
<Tag enumID="321" name="COLLECTIBLE" type="Int" value="1"/> | ||
<Tag enumID="1635" name="SPELL_SCHOOL" type="Int" value="2"/> | ||
</Entity> | ||
</CardDefs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<CardDefs build="212197"> | ||
<Entity CardID="AT_001" ID="2539" version="2"> | ||
<Tag enumID="185" name="CARDNAME" type="LocString"> | ||
<deDE>Flammenlanze</deDE> | ||
</Tag> | ||
<Tag enumID="184" name="CARDTEXT" type="LocString"> | ||
<deDE>Fügt einem Diener $25 Schaden zu.</deDE> | ||
</Tag> | ||
<Tag enumID="351" name="FLAVORTEXT" type="LocString"> | ||
<deDE>Die Sommerversion der Eislanze. Gut gegen chronisch kalte Hände.</deDE> | ||
</Tag> | ||
</Entity> | ||
</CardDefs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters