Exemplo n.º 1
0
        public void Setup()
        {
            var enumerableConverter = new EnumerableConverter <ItemType, JsonStringEnumConverter>();

            using var ms = new MemoryStream();
            using (var writer = new Utf8JsonWriter(ms))
            {
                var itemTypeList = new List <ItemType>
                {
                    ItemType.Unknown,
                    ItemType.Address
                };

                writer.WriteStartArray();
                enumerableConverter.Write(writer, itemTypeList, new JsonSerializerOptions());
                writer.WriteEndArray();
            }

            _result = System.Text.Encoding.UTF8.GetString(ms.ToArray());
        }