mirror of https://github.com/Squidex/squidex.git
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.
42 lines
1.4 KiB
42 lines
1.4 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Text.Json.Serialization;
|
|
using Squidex.Domain.Apps.Core.TestHelpers;
|
|
using Squidex.Infrastructure.Json;
|
|
using Xunit;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Apps.DomainObject
|
|
{
|
|
public class AppStateTests
|
|
{
|
|
private readonly IJsonSerializer serializer = TestUtils.CreateSerializer(options =>
|
|
{
|
|
options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
|
});
|
|
|
|
[Fact]
|
|
public void Should_deserialize_state()
|
|
{
|
|
var json = File.ReadAllText("Apps/DomainObject/AppState.json");
|
|
|
|
var deserialized = serializer.Deserialize<AppDomainObject.State>(json);
|
|
|
|
Assert.NotNull(deserialized);
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_serialize_deserialize_state()
|
|
{
|
|
var json = File.ReadAllText("Apps/DomainObject/AppState.json").CleanJson();
|
|
|
|
var serialized = serializer.Serialize(serializer.Deserialize<AppDomainObject.State>(json), true);
|
|
|
|
Assert.Equal(json, serialized);
|
|
}
|
|
}
|
|
}
|
|
|