Skip to content

Commit

Permalink
refactorings:
Browse files Browse the repository at this point in the history
- removed constructors from all objects
- made types more verbose
- fixed tests on linux
- added more logging
  • Loading branch information
tolik518 committed Feb 19, 2024
1 parent af22c7b commit bc16278
Show file tree
Hide file tree
Showing 29 changed files with 281 additions and 212 deletions.
144 changes: 125 additions & 19 deletions SoG_SGreader.Test/DataReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private static Player GetSaveGame(int saveGameNumber)
if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) {
projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE");
}
else
else if (Environment.OSVersion.Platform != PlatformID.Unix)
{
projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader");
}
Expand Down Expand Up @@ -95,15 +95,68 @@ private void TestCanReadBirthday(int birthdayDay, int birthdayMonth, Player play

private static IEnumerable<object[]> FirstItem()
{
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 189755), GetSaveGame(0).Inventory };
yield return new object[] { new Item(SogItems.KeyItem_DivaMirror, 0, 158319), GetSaveGame(1).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 46623), GetSaveGame(2).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 16756), GetSaveGame(3).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 25026), GetSaveGame(4).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 18895), GetSaveGame(5).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 16634), GetSaveGame(6).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 14455), GetSaveGame(7).Inventory };
yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 96617), GetSaveGame(8).Inventory };
yield return new object[] {
new Item {
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 189755
}, GetSaveGame(0).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.KeyItem_DivaMirror,
ItemCount = 0,
ItemPos = 158319
}, GetSaveGame(1).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 46623
}, GetSaveGame(2).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 16756
}, GetSaveGame(3).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 25026
}, GetSaveGame(4).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 18895
}, GetSaveGame(5).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 16634
}, GetSaveGame(6).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 14455
}, GetSaveGame(7).Inventory };

yield return new object[] {
new Item{
ItemID = SogItems.Usable_CardAlbum,
ItemCount = 1,
ItemPos = 96617
}, GetSaveGame(8).Inventory };
}

[Theory]
Expand All @@ -115,15 +168,68 @@ private void TestCanGetFirstItemFromInventory(Item firstItem, List<Item> invento

private static IEnumerable<object[]> LastItem()
{
yield return new object[] { new Item(SogItems.Furniture_Decoration_ArcadeChallengeTrophyF08, 1, 189760), GetSaveGame(0).Inventory };
yield return new object[] { new Item(SogItems.KeyItem_CatalystOfPower, 1, 159243), GetSaveGame(1).Inventory };
yield return new object[] { new Item(SogItems.KeyItem_CatalystOfPower, 1, 46457), GetSaveGame(2).Inventory };
yield return new object[] { new Item(SogItems.Shoes_MushroomSlippers, 1, 16738), GetSaveGame(3).Inventory };
yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 25025), GetSaveGame(4).Inventory };
yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 18894), GetSaveGame(5).Inventory };
yield return new object[] { new Item(SogItems.Furniture_Carpet_MasterHQRed, 0, 16614), GetSaveGame(6).Inventory };
yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 14454), GetSaveGame(7).Inventory };
yield return new object[] { new Item(SogItems.OneHanded_UgrasScroll, 1, 96375), GetSaveGame(8).Inventory };
yield return new object[] {
new Item {
ItemID = SogItems.Furniture_Decoration_ArcadeChallengeTrophyF08,
ItemCount = 1,
ItemPos = 189760
}, GetSaveGame(0).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.KeyItem_CatalystOfPower,
ItemCount = 1,
ItemPos = 159243
}, GetSaveGame(1).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.KeyItem_CatalystOfPower,
ItemCount = 1,
ItemPos = 46457
}, GetSaveGame(2).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.Shoes_MushroomSlippers,
ItemCount = 1,
ItemPos = 16738},
GetSaveGame(3).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.TwoHanded_BugNet,
ItemCount = 0,
ItemPos = 25025
}, GetSaveGame(4).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.TwoHanded_BugNet,
ItemCount = 0,
ItemPos = 18894},
GetSaveGame(5).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.Furniture_Carpet_MasterHQRed,
ItemCount = 0,
ItemPos = 16614},
GetSaveGame(6).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.TwoHanded_BugNet,
ItemCount = 0,
ItemPos =14454},
GetSaveGame(7).Inventory };

yield return new object[] {
new Item {
ItemID = SogItems.OneHanded_UgrasScroll,
ItemCount = 1,
ItemPos =96375
}, GetSaveGame(8).Inventory };
}

[Theory]
Expand Down
4 changes: 2 additions & 2 deletions SoG_SGreader.Test/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private static string GetExePath()
projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE");
return Path.Combine(projectDirectory, "SoG_SGreader", "bin", "Release", "SoG_SGreader.exe");
}
else
else if (Environment.OSVersion.Platform != PlatformID.Unix)
{
projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader");
}
Expand All @@ -32,7 +32,7 @@ private static string GetSaveGamePath(string saveGameNumber)
if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) {
projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE");
}
else
else if (Environment.OSVersion.Platform != PlatformID.Unix)
{
projectDirectory = Path.Combine(projectDirectory,"SoG_SGreader");
}
Expand Down
Loading

0 comments on commit bc16278

Please sign in to comment.