28 lines
577 B
C#
28 lines
577 B
C#
using Shogi.Domain.ValueObjects;
|
|
|
|
namespace Shogi.Domain.Aggregates;
|
|
|
|
public class Session
|
|
{
|
|
public Session(
|
|
string name,
|
|
string player1Name,
|
|
ShogiBoard board)
|
|
{
|
|
Name = name;
|
|
Player1 = player1Name;
|
|
Board = board;
|
|
}
|
|
|
|
public string Name { get; }
|
|
public ShogiBoard Board { get; }
|
|
public string Player1 { get; }
|
|
public string? Player2 { get; private set; }
|
|
|
|
public void AddPlayer2(string player2Name)
|
|
{
|
|
if (Player2 != null) throw new InvalidOperationException("Player 2 already exists while trying to add a second player.");
|
|
Player2 = player2Name;
|
|
}
|
|
}
|