<commit_before>﻿using System.Threading.Tasks;
using NUnit.Framework;

[TestFixture]
public class AsyncUsage
{
    [Test]
    public async Task Works()
    {
        var target = new SimpleUsage.ClassWithString
        {
            Property = "Foo"
        };
        var result = await RoundTrip.RunAsync(target);
        Assert.AreEqual("Foo", result.Property);
    }
}<commit_msg>fix async test<commit_after>﻿using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Encryption;
using NUnit.Framework;

[TestFixture]
public class AsyncUsage
{
    [Test]
    public async Task Works()
    {
        var target = new ClassWithString
        {
            Property = "Foo"
        };

        using (var factory = new EncryptionFactory())
        using (var algorithm = CryptoBuilder.Build())
        {
            var serializer = new JsonSerializer
            {
                ContractResolver = factory.GetContractResolver()
            };

            string serialized;
            using (factory.GetEncryptSession(algorithm))
            {
                await Task.Delay(1).ConfigureAwait(false);
                serialized = serializer.Serialize(target);
            }
            using (factory.GetDecryptSession(algorithm))
            {
                await Task.Delay(1).ConfigureAwait(false);
                var result = serializer.Deserialize<ClassWithString>(serialized);
                Assert.AreEqual("Foo", result.Property);
            }
        }


    }

    public class ClassWithString
    {
        [Encrypt]
        public string Property { get; set; }
    }
}
{'fraction_non_alphanumeric': 0.09266169154228855, 'fraction_numerical': 0.0012437810945273632, 'mean_word_length': 1.9095840867992766, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7086916', 'n_tokens_mistral': 428, 'n_tokens_neox': 417, 'n_words': 91}