54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using GameData.Repository;
|
|
using GameModel;
|
|
using GameModel.DeathGame;
|
|
using Newtonsoft.Json;
|
|
using System.Data.Common;
|
|
|
|
namespace GameData.UnitTests
|
|
{
|
|
record TestRecord(PinState PinState);
|
|
|
|
public class Tests
|
|
{
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
}
|
|
|
|
[Test]
|
|
public void Serialize_PinPicture()
|
|
{
|
|
var r = new TestRecord(PinState.Down);
|
|
var p = PinPicture.Create();
|
|
|
|
string s = JsonConvert.SerializeObject(p);
|
|
string s2 = JsonConvert.SerializeObject(r);
|
|
|
|
var p2 = JsonConvert.DeserializeObject<PinPicture>(s);
|
|
}
|
|
|
|
[Test]
|
|
public void Test1()
|
|
{
|
|
var setting = new DeathGameSettings(77);
|
|
var gm = new DeathGameModel(1, new[] { new Coffin(1, 0, 0) }, setting, new[] { 1, 2, 3 });
|
|
var gameState = GameState.Create(Guid.NewGuid(), "test", ThrowState.Create(ThrowMode.Reposition,99), 1, gm);
|
|
|
|
string test = JsonConvert.SerializeObject(
|
|
gameState,
|
|
new JsonSerializerSettings()
|
|
{
|
|
TypeNameHandling = TypeNameHandling.Auto
|
|
});
|
|
|
|
var obj = JsonConvert.DeserializeObject<GameState>(test, new JsonSerializerSettings()
|
|
{
|
|
TypeNameHandling = TypeNameHandling.Auto
|
|
});
|
|
|
|
|
|
//var client = new ExpenseRepository(null, null, null);
|
|
//var test = client.GetAll();
|
|
}
|
|
}
|
|
} |