squash a bunch of commits
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Newtonsoft.Json;
|
||||
using Shogi.Contracts.Api;
|
||||
using Shogi.Contracts.Types;
|
||||
using System;
|
||||
|
||||
namespace UnitTests.ServiceModels;
|
||||
|
||||
public class ServiceModelsShouldSerialize
|
||||
{
|
||||
[Fact]
|
||||
public void ServiceModelsSerializeAndDeserialize()
|
||||
{
|
||||
using var scope = new AssertionScope();
|
||||
AssertTypeDeserializes(new CreateGuestTokenResponse("MyId", "MyDisplayName", Guid.NewGuid()));
|
||||
AssertTypeDeserializes(new SessionMetadata { Name = "MyName", PlayerCount = 5 });
|
||||
}
|
||||
|
||||
private static void AssertTypeDeserializes<T>(T t) where T : class
|
||||
{
|
||||
var serialized = JsonConvert.SerializeObject(t);
|
||||
var deserialized = JsonConvert.DeserializeObject<T>(serialized);
|
||||
|
||||
deserialized.Should().BeEquivalentTo(t);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user