<commit_before>namespace Gu.Persist.Core.Tests.Repositories
{
    using System;
    using System.IO;
    using System.Runtime.CompilerServices;

    public abstract partial class RepositoryTests
    {
        public static readonly TestCase[] TestCases =
        {
            new FileInfo(),
            new FullFileName(),
            new FileNameWithExtension(),
            new FileNameWithOutExtension(),
            new Generic(),
            new FileInfoAsync(),
            new FullFileNameAsync(),
            new FileNameWithExtensionAsync(),
            new FileNameWithOutExtensionAsync(),
            new GenericAsync(),
        };

        public abstract class TestCase
        {
            public abstract T Read<T>(IRepository repository, System.IO.FileInfo file, Migration? migration = null);

            public abstract T ReadOrCreate<T>(IRepository repository, System.IO.FileInfo file, Func<T> create, Migration? migration = null);

            public abstract void Save<T>(IRepository repository, System.IO.FileInfo file, T item);

            public abstract bool IsDirty<T>(IRepository repository, System.IO.FileInfo file, T item);

            public virtual System.IO.FileInfo File<T>(IRepository repository, [CallerMemberName] string? name = null) => repository.GetFileInfo(name);

            public System.IO.FileInfo? BackupFile<T>(IRepository repository, [CallerMemberName] string? name = null)
            {
                return repository.Settings.BackupSettings is IBackupSettings backupSettings
                    ? Core.Backup.BackupFile.CreateFor(this.File<T>(repository, name), backupSettings)
                    : null;
            }
        }

        private class FileInfo : TestCase
        {
            public override T Read<T>(IRepository repository, System.IO.FileInfo file, Migration? migration = null) => repository.Read<T>(file, migration);

            public override T ReadOrCreate<T>(IRepository repository, System.IO.FileInfo file, Func<T> create, Migration? migration = null) => repository.ReadOrCreate(file, create, migration);

            public override void Save<T>(IRepository repository, System.IO.FileInfo file, T item) => repository.Save(file, item);

            public override bool IsDirty<T>(IRepository repository, System.IO.FileInfo file, T item) => repository.IsDirty(file, item);
        }

        private class FileInfoAsync : TestCase
        {<commit_msg>Fix warning.<commit_after>namespace Gu.Persist.Core.Tests.Repositories
{
    using System;
    using System.IO;
    using System.Runtime.CompilerServices;

    public abstract partial class RepositoryTests
    {
        public static readonly TestCase[] TestCases =
        {
            new FileInfo(),
            new FullFileName(),
            new FileNameWithExtension(),
            new FileNameWithOutExtension(),
            new Generic(),
            new FileInfoAsync(),
            new FullFileNameAsync(),
            new FileNameWithExtensionAsync(),
            new FileNameWithOutExtensionAsync(),
            new GenericAsync(),
        };

        public abstract class TestCase
        {
            public abstract T Read<T>(IRepository repository, System.IO.FileInfo file, Migration? migration = null);

            public abstract T ReadOrCreate<T>(IRepository repository, System.IO.FileInfo file, Func<T> create, Migration? migration = null);

            public abstract void Save<T>(IRepository repository, System.IO.FileInfo file, T item);

            public abstract bool IsDirty<T>(IRepository repository, System.IO.FileInfo file, T item);

            public virtual System.IO.FileInfo File<T>(IRepository repository, [CallerMemberName] string? name = null) => name is null
                ? repository.GetFileInfo<T>()
                : repository.GetFileInfo(name);

            public System.IO.FileInfo? BackupFile<T>(IRepository repository, [CallerMemberName] string? name = null)
            {
                return repository.Settings.BackupSettings is IBackupSettings backupSettings
                    ? Core.Backup.BackupFile.CreateFor(this.File<T>(repository, name), backupSettings)
                    : null;
            }
        }

        private class FileInfo : TestCase
        {
            public override T Read<T>(IRepository repository, System.IO.FileInfo file, Migration? migration = null) => repository.Read<T>(file, migration);

            public override T ReadOrCreate<T>(IRepository repository, System.IO.FileInfo file, Func<T> create, Migration? migration = null) => repository.ReadOrCreate(file, create, migration);

            public override void Save<T>(IRepository repository, System.IO.FileInfo file, T item) => repository.Save(file, item);

            public override bool IsDirty<T>(IRepository repository, System.IO.FileInfo file, T item) => repository.IsDirty(file, item);
        }

        private class FileInfoAsync : TestCase
        {
{'fraction_non_alphanumeric': 0.09006462035541195, 'fraction_numerical': 0.0, 'mean_word_length': 2.5839363241678726, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 42, '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': '2768134', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1210, 'n_words': 337}