Ejemplo n.º 1
0
        public void CanConvert_Returns_Expected_Value(
            Type typeToConvert,
            bool expected)
        {
            var converter = new CallbackEventJsonConverter();

            Assert.Equal(
                expected,
                converter.CanConvert(typeToConvert));
        }
Ejemplo n.º 2
0
        private static string Serialize <T>(
            T callbackEvent)
            where T : CallbackEvent
        {
            using var stream = new MemoryStream();
            using var writer = new Utf8JsonWriter(stream);
            var converter = new CallbackEventJsonConverter();

            converter.Write(
                writer,
                callbackEvent,
                Options);
            writer.Flush();

            return(Encoding.UTF8.GetString(stream.ToArray()));
        }