Set up instances for UTs

pull/83/head
Alexis Drai 3 years ago
parent c63729b0b2
commit 4d07c3ffc1

@ -56,6 +56,7 @@ namespace Model.Games
/// <summary>
/// the group of dice used for this game
/// </summary>
public IEnumerable<AbstractDie<AbstractDieFace>> Dice => dice;
private readonly IEnumerable<AbstractDie<AbstractDieFace>> dice;
/// <summary>

@ -0,0 +1,61 @@
using Model.Dice.Faces;
using Model.Dice;
using Model.Games;
using Model.Players;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tests.Model_UTs
{
public class GameTest
{
private static readonly string GAME_NAME = "my game";
private static readonly Player PLAYER_1 = new("Alice"), PLAYER_2 = new("Bob"), PLAYER_3 = new("Clyde");
private readonly static NumberDieFace[] FACES_1 = new NumberDieFace[]
{
new(1),
new(2),
new(3),
new(4)
};
private readonly static ImageDieFace[] FACES_2 = new ImageDieFace[]
{
new(10),
new(20),
new(30),
new(40)
};
private readonly static ColorDieFace[] FACES_3 = new ColorDieFace[]
{
new(1000),
new(2000),
new(3000),
new(4000)
};
private static readonly AbstractDie<AbstractDieFace> NUM = new NumberDie(FACES_1), IMG = new ImageDie(FACES_2), CLR = new ColorDie(FACES_3);
private static readonly IEnumerable<AbstractDie<AbstractDieFace>> dice =
new List<AbstractDie<AbstractDieFace>>() { NUM, IMG, CLR }
.AsEnumerable();
public GameTest()
{
Game game = new(name: GAME_NAME, playerManager: new PlayerManager(), dice: dice);
game.AddPlayerToGame(PLAYER_1);
game.AddPlayerToGame(PLAYER_2);
game.AddPlayerToGame(PLAYER_3);
}
}
}

@ -50,14 +50,11 @@ namespace Tests.Model_UTs
new(412)
};
private readonly AbstractDie<AbstractDieFace> NUM1 = new NumberDie(FACES1);
private readonly AbstractDie<AbstractDieFace> NUM2 = new NumberDie(FACES2);
private readonly AbstractDie<AbstractDieFace> IMG1 = new ImageDie(FACES3);
private readonly AbstractDie<AbstractDieFace> CLR1 = new ColorDie(FACES4);
public TurnTest()
{
DICE_N_FACES = new()

Loading…
Cancel
Save