Files
MonoGame.Extended/tests/MonoGame.Extended.Tests/Serialization/RectangleFJsonConverterTest.cs
T
Christopher WhitleyandGitHub d008b1bd41 Replace Newtonsoft.Json with System.Text.Json (#869)
* Converted to use `System.Text.Json`

* Remove Newtonsoft.Json Dependency
Newtonsoft.Json dependency has been removed in favor of System.Text.Json

* Treat MGFXO file as binary
2024-05-22 23:23:36 -04:00

37 lines
831 B
C#

using System.IO;
using System.Text.Json;
using MonoGame.Extended.Serialization;
using Xunit;
namespace MonoGame.Extended.Tests.Serialization;
public class RectangleFJsonConverterTest
{
public class TestContent
{
public RectangleF Box { get; set; }
}
[Fact]
public void ConstructorTest()
{
var jsonData = @"
{
""box"": ""1 1 10 10""
}
";
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
options.Converters.Add(new RectangleFJsonConverter());
var content = JsonSerializer.Deserialize<TestContent>(jsonData, options);
Assert.Equal(1, content.Box.Left);
Assert.Equal(1, content.Box.Top);
Assert.Equal(10, content.Box.Width);
Assert.Equal(10, content.Box.Height);
}
}