using Infrastructure.DataAccess;
using Infrastructure.Interfaces;
using Infrastructure.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Services
{
    public class TestSuiteService : ITestSuiteService, IDisposable
    {
        public TestSuiteService() : this(new TestProjectService(), new AppDbContext())
        {
        }

        public TestSuiteService(ITestProjectService testProjectService, AppDbContext context)
        {
            _testProjectService = testProjectService;
            _context = context;
        }

        public ITestProjectService _testProjectService { get; private set; }
        public AppDbContext _context { get; private set; }

        public IEnumerable<TestSuite> ListTestSuites()
        {
            var projectID = _testProjectService.Project.ID;
                
            return _context.TestSuites.Where(t => t.ProjectID == projectID);
        }

        public void Dispose()
        {
            _context.Dispose();
        }
    }
}