Skip to content

Commit

Permalink
Merge branch 'main' into bunkum-4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Oct 1, 2023
2 parents 0a058c0 + eb34547 commit 0a5a71d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,12 @@ public class GameUserResponse : IDataConvertableFrom<GameUserResponse, GameUser>
EntitledSlotsLBP2 = 100,
EntitledSlotsLBP3 = 100,
UsedSlots = 0,
UsedSlotsLBP2 = old.PublishedLevels.Count(),
UsedSlotsLBP2 = 0,
UsedSlotsLBP3 = 0,
PurchasedSlotsLBP2 = 0,
PurchasedSlotsLBP3 = 0,
FreeSlots = 100,
FreeSlotsLBP3 = 100,
};

response.FreeSlotsLBP2 = 100 - response.UsedSlotsLBP2;

return response;
}

Expand All @@ -102,5 +98,45 @@ private void FillInExtraData(GameUser old, TokenGame gameVersion)
TokenGame.Website => "0",
_ => throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null),
};

//Fill out the used slots
switch (gameVersion)
{
case TokenGame.LittleBigPlanet3: {
//Match all LBP3 levels
this.UsedSlotsLBP3 = old.PublishedLevels.Count(x => x._GameVersion == (int)TokenGame.LittleBigPlanet3);
this.FreeSlotsLBP3 = 100 - this.UsedSlotsLBP3;
//Fill out LBP2/LBP1 levels
goto case TokenGame.LittleBigPlanet2;
}
case TokenGame.LittleBigPlanet2: {
//Match all LBP2 levels
this.UsedSlotsLBP2 = old.PublishedLevels.Count(x => x._GameVersion == (int)TokenGame.LittleBigPlanet2);
this.FreeSlotsLBP2 = 100 - this.UsedSlotsLBP2;
//Fill out LBP1 levels
goto case TokenGame.LittleBigPlanet1;
}
case TokenGame.LittleBigPlanetVita: {
//Match all LBP Vita levels
this.UsedSlotsLBP2 = old.PublishedLevels.Count(x => x._GameVersion == (int)TokenGame.LittleBigPlanetVita);
this.FreeSlotsLBP2 = 100 - this.UsedSlotsLBP2;
break;
}
case TokenGame.LittleBigPlanet1: {
//Match all LBP1 levels
this.UsedSlots = old.PublishedLevels.Count(x => x._GameVersion == (int)TokenGame.LittleBigPlanet1);
this.FreeSlots = 100 - this.UsedSlots;
break;
}
case TokenGame.LittleBigPlanetPSP: {
//Match all LBP PSP levels
this.UsedSlots = old.PublishedLevels.Count(x => x._GameVersion == (int)TokenGame.LittleBigPlanetPSP);
this.FreeSlots = 100 - this.UsedSlots;
break;
}
case TokenGame.Website: break;
default:
throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null);
}
}
}
5 changes: 4 additions & 1 deletion RefreshTests.GameServer/RefreshTests.GameServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions RefreshTests.GameServer/Tests/Users/UserRetrievalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public void SetUp()
this._db = this._context.Database;
}

[OneTimeTearDown]
public void TearDown()
{
this._context.Dispose();
this._db.Dispose();
}

[Test]
public void GetByObjectId()
{
Expand Down

0 comments on commit 0a5a71d

Please sign in to comment.