You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/TestBase/TestPersistence.cs

42 lines
1.3 KiB

using Xunit;
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Persistences;
using System.IO;
namespace TestBase
{
public class TestPersistence
{
/* [Fact]
public void Test_SaveGame()
{
var game = new Game();
IGamePersistence gamePersistence = new GamePersistenceJson();
gamePersistence.SaveGame(game);
Assert.True(File.Exists("Game.json"));
}
[Fact]
public void Test_LoadGame()
{
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\..\\Files"));
var game = new Game();
game.AddPlayerInGame(["Jules", "Jérémy"]);
game.StartGame();
IGamePersistence gamePersistence = new GamePersistenceJson();
gamePersistence.SaveGame(game);
var loadedGame = gamePersistence.LoadGame();
Assert.True(game.Board.ReadCells.All(cell =>
cell.GetX == loadedGame.Board.GetCell(cell.GetX, cell.GetY)!.GetX &&
cell.GetY == loadedGame.Board.GetCell(cell.GetX, cell.GetY)!.GetY &&
cell.IsFree == loadedGame.Board.GetCell(cell.GetX, cell.GetY)!.IsFree));
}*/
}
}