-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathListSerializationTests.cs
More file actions
31 lines (27 loc) · 1020 Bytes
/
Copy pathListSerializationTests.cs
File metadata and controls
31 lines (27 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections.Generic;
using Xunit;
using Xunit.Abstractions;
using com.IvanMurzak.ReflectorNet.Utils;
namespace com.IvanMurzak.ReflectorNet.Tests.Utils
{
public class ListSerializationTests : BaseTest
{
public ListSerializationTests(ITestOutputHelper output) : base(output) { }
public class ClassWithList
{
public List<int>? IntList { get; set; }
}
[Fact]
public void TestListDeserialization()
{
var original = new ClassWithList { IntList = new List<int> { 1, 2, 3 } };
var reflector = new Reflector();
var serialized = reflector.Serialize(original);
var deserialized = reflector.Deserialize<ClassWithList>(serialized);
Assert.NotNull(deserialized);
Assert.NotNull(deserialized.IntList);
Assert.Equal(original.IntList.Count, deserialized.IntList.Count);
Assert.Equal(original.IntList[0], deserialized.IntList[0]);
}
}
}