test: add unit tests for Blackjack and TicTacToe
- Add xUnit test projects for both games - Implement game flow tests for Blackjack - Implement game flow tests for TicTacToe - Rename namespaces and projects to follow `Game.*` convention - Add documentation for testing games
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace Game.Blackjack;
|
||||
|
||||
public enum GamePhase : byte
|
||||
{
|
||||
Betting = 0,
|
||||
Dealing = 1,
|
||||
PlayerTurn = 2,
|
||||
DealerTurn = 3,
|
||||
RoundOver = 4
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace Game.Blackjack;
|
||||
|
||||
/// <summary>
|
||||
/// Global game state stored on the singleton entity.
|
||||
/// </summary>
|
||||
[MessagePackObject]
|
||||
public struct GameState
|
||||
{
|
||||
[Key(0)] public GamePhase Phase;
|
||||
[Key(1)] public RoundResult Result;
|
||||
[Key(2)] public int Chips;
|
||||
[Key(3)] public int CurrentBet;
|
||||
[Key(4)] public int RoundNumber;
|
||||
[Key(5)] public uint Seed;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Game.Blackjack;
|
||||
|
||||
public enum RoundResult : byte
|
||||
{
|
||||
None = 0,
|
||||
PlayerBust = 1,
|
||||
DealerBust = 2,
|
||||
PlayerWin = 3,
|
||||
DealerWin = 4,
|
||||
Push = 5,
|
||||
Blackjack = 6
|
||||
}
|
||||
Reference in New Issue
Block a user