using Autofac;

using Nitride.Tests;

using Serilog;

using Zio;
using Zio.FileSystems;

namespace Nitride.IO.Tests;

public class NitrideIOTestContext : NitrideTestContext
{
    private static int bob = 0;

    public IFileSystem FileSystem => this.Resolve<IFileSystem>();

    /// <inheritdoc />
    protected override void ConfigureContainer(ContainerBuilder builder)
    {
        base.ConfigureContainer(builder);
        builder.RegisterModule<NitrideIOModule>();

        builder.RegisterInstance(new MemoryFileSystem()).As<IFileSystem>().SingleInstance();

        builder.RegisterBuildCallback(x => x.Resolve<ILogger>().Error("Registered!"));
        builder.RegisterInstance(new Bob { Value = bob++ }).As<Bob>().SingleInstance();
    }

    public class Bob
    {
        public int Value { get; set; }
    }
}