<commit_before>﻿using System;
using System.Runtime.Caching;
using Xunit;

namespace Remember.Tests
{
    public class RememberTests
    {
        public class Integration : IDisposable
        {
            private readonly IRemember remember = Remember.Instance;

            [Fact]
            public void CallingAllMethods()
            {
                var cacheKey = "<EMAIL>";
                var expectedInnerUser = new User { Email = "<EMAIL>", Password = "<PASSWORD>==" };
                var expectedUser = new User { Email = cacheKey, Password = "<PASSWORD>==", InnerUser = expectedInnerUser };

                var actual = remember.GetAsync<User>(cacheKey).Result;
                Assert.Null(actual);

                remember.SaveAsync<User>(cacheKey, expectedUser).Wait();
                actual = remember.GetAsync<User>(cacheKey).Result;
                Assert.NotNull(actual);
                Assert.NotNull(actual.InnerUser);
                Assert.Equal(expectedUser.Email, actual.Email);
                Assert.Equal(expectedUser.Password, actual.Password);
                Assert.Equal(expectedInnerUser.Email, actual.InnerUser.Email);
                Assert.Equal(expectedInnerUser.Password, actual.InnerUser.Password);

                MemoryCache.Default.Remove(cacheKey);
                actual = remember.GetAsync<User>(cacheKey).Result;
                Assert.NotNull(actual);

                remember.DeleteAsync(cacheKey).Wait();
                actual = remember.GetAsync<User>(cacheKey).Result;
                Assert.Null(actual);
            }

            public class User
            {
                public string Email { get; set; }

                public string Password { get; set; }

                public User InnerUser { get; set; }
            }<commit_msg>Use async/await on integration tests<commit_after>﻿using System;
using System.Runtime.Caching;
using System.Threading.Tasks;
using Xunit;

namespace Remember.Tests
{
    public class RememberTests
    {
        public class Integration : IDisposable
        {
            private readonly IRemember remember = Remember.Instance;

            [Fact]
            public async Task CallingAllMethods()
            {
                var cacheKey = "<EMAIL>";
                var expectedInnerUser = new User { Email = "<EMAIL>", Password = "<PASSWORD>==" };
                var expectedUser = new User { Email = cacheKey, Password = "<PASSWORD>==", InnerUser = expectedInnerUser };

                var actual = await remember.GetAsync<User>(cacheKey);
                Assert.Null(actual);

                await remember.SaveAsync<User>(cacheKey, expectedUser);
                actual = await remember.GetAsync<User>(cacheKey);
                Assert.NotNull(actual);
                Assert.NotNull(actual.InnerUser);
                Assert.Equal(expectedUser.Email, actual.Email);
                Assert.Equal(expectedUser.Password, actual.Password);
                Assert.Equal(expectedInnerUser.Email, actual.InnerUser.Email);
                Assert.Equal(expectedInnerUser.Password, actual.InnerUser.Password);

                MemoryCache.Default.Remove(cacheKey);
                actual = await remember.GetAsync<User>(cacheKey);
                Assert.NotNull(actual);

                await remember.DeleteAsync(cacheKey);
                actual = await remember.GetAsync<User>(cacheKey);
                Assert.Null(actual);
            }

            public class User
            {
                public string Email { get; set; }

                public string Password { get; set; }

                public User InnerUser { get; set; }
            }
{'fraction_non_alphanumeric': 0.0964840556009812, 'fraction_numerical': 0.0, 'mean_word_length': 1.8515928515928517, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2951766', 'n_tokens_mistral': 912, 'n_tokens_neox': 838, 'n_words': 191}