public static void WritePrimitiveIImmutableListT() { IImmutableList <int> input = ImmutableList.CreateRange(new List <int> { 1, 2 }); string json = JsonSerializer.Serialize(input); Assert.Equal("[1,2]", json); StringIImmutableListWrapper input2 = new StringIImmutableListWrapper(new List <string> { "1", "2" }); json = JsonSerializer.Serialize(input2); Assert.Equal(@"[""1"",""2""]", json); }
public async Task WritePrimitiveIImmutableListT() { IImmutableList <int> input = ImmutableList.CreateRange(new List <int> { 1, 2 }); string json = await JsonSerializerWrapperForString.SerializeWrapper(input); Assert.Equal("[1,2]", json); StringIImmutableListWrapper input2 = new StringIImmutableListWrapper(new List <string> { "1", "2" }); json = await JsonSerializerWrapperForString.SerializeWrapper(input2); Assert.Equal(@"[""1"",""2""]", json); }
// Call only when testing serialization. public void Initialize() { MyStringIImmutableListWrapper = new StringIImmutableListWrapper(new List <string> { "Hello" }); }