Add Timelines serialization test
This commit is contained in:
parent
a02e8121eb
commit
ff9e6196ad
@ -14,6 +14,31 @@ public class SerializationTest
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void SerializeRoundTrip_Timelines()
|
||||
{
|
||||
Timelines one = Timelines.Create();
|
||||
|
||||
string serial1 = JsonSerializer.Serialize(one, Options);
|
||||
Timelines two = JsonSerializer.Deserialize<Timelines>(serial1, Options)
|
||||
?? throw new AssertionException("Failed to deserialize");
|
||||
|
||||
Assert.That(two.Next, Is.EqualTo(one.Next), "Failed to reserialize next timeline");
|
||||
Assert.That(two.Pasts, Is.EquivalentTo(one.Pasts), "Failed to reserialize pasts");
|
||||
|
||||
Timelines three = two
|
||||
.WithNewSeason(Season.First, out var a1)
|
||||
.WithNewSeason(a1, out var a2)
|
||||
.WithNewSeason(a1, out var b2);
|
||||
|
||||
string serial2 = JsonSerializer.Serialize(three, Options);
|
||||
Timelines four = JsonSerializer.Deserialize<Timelines>(serial2, Options)
|
||||
?? throw new AssertionException("Failed to deserialize");
|
||||
|
||||
Assert.That(four.Next, Is.EqualTo(three.Next), "Failed to reserialize next timeline");
|
||||
Assert.That(four.Pasts, Is.EquivalentTo(three.Pasts), "Failed to reserialize pasts");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializeRoundTrip_NewGame()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user