示例#1
0
        public static async Task DeserializeString(string s, string encoding)
        {
            var enc = Encoding.GetEncoding(encoding);

            var stream       = new MemoryStream();
            var streamWriter = new StreamWriter(stream, enc);

            await streamWriter.WriteAsync(s);

            await streamWriter.FlushAsync();

            var settings = SmppSerializationSettings.Default;

            settings.DefaultEncoding = enc;

            var serializer = new SmppSerializer();

            var result = await serializer.DeserializeAsync <string>(new SmppReader(stream, true), settings);

            Assert.Equal(s, result);
        }