using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VCommon.VEntity;
using VCommon.VEntityFrameworkCore.Tests.Efc;
using Xunit.Abstractions;

namespace VCommon.VEntityFrameworkCore.Tests.Repo
{
    public class TestRepository<TEntity> : VEfRepositoryBase<TestDbContext, TEntity> where TEntity : VEntityBase
    {
        private readonly ITestOutputHelper _testOutput;

        public TestRepository(ITestOutputHelper testOutput)
        {
            _testOutput = testOutput;
        }

        public override VEfRepositoryBase<TestDbContext, TForkEntity> ForkRepository<TForkEntity>()
        {
            return new TestRepository<TForkEntity>(_testOutput)
            {
                DbContext = DbContext
            };
        }

        protected override TestDbContext ResolveDbContextInstance()
        {
            return new(_testOutput);
        }
    }
}
