﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data.Entity;
using System.Linq;

namespace StatsData.Test.Integration
{
    [TestClass]
    public class ClubTests
    {
        StatsContext _context;

        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //    Database.SetInitializer(new IntegrationTestInitializer());
        //}

        //[ClassCleanup()]
        //public static void MyClassCleanup() { }

        [TestInitialize()]
        public void MyTestInitialize() 
        {
            _context = new StatsContext();
            _context.Database.Initialize(false);
        }

        [TestCleanup()]
        public void MyTestCleanup() 
        {
            _context.Dispose();
            _context = null;
        }

        [TestMethod]
        public void Club_SelectAll()
        {
            var clubs = _context.Clubs.ToList();
            Assert.AreEqual(4, clubs.Count);
        }

        [TestMethod]
        public void Club_FindOne()
        {
            var club = _context.Clubs.Find(1);
            Assert.AreEqual("Driver", club.ClubName);
        }
    }
}
