using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using ResourcesManager.Controllers;
using ResourcesManager.Interfaces;
using ResourcesManager.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace ResourcesManager.Controllers.Tests
{
    [TestClass()]
    public class SubscribeControllerTests
    {
        Mock<IResourceRepository> mockResourceRepo;
        Mock<IUserRepository> mockUserRepo;
        Mock<IStatisticRepository> mockStatRepo;
        SubscribeController subController;

        [TestInitialize]
        public void InitializeTestData()
        {
            mockResourceRepo = new Mock<IResourceRepository>() { CallBase = true };
            mockUserRepo = new Mock<IUserRepository>() { CallBase = true };
            mockStatRepo = new Mock<IStatisticRepository> { CallBase = true };
            subController = new SubscribeController(mockResourceRepo.Object, mockUserRepo.Object, mockStatRepo.Object);
        }

        [TestMethod()]
        public void Subscribe_Get_Index_Test()
        {
            var result = subController.Index();
            Assert.IsNotNull((result as ViewResult).Model);
        }

        [TestMethod()]
        public void Subscribe_Follow_Test()
        {
            var result = subController.Follow(1);
            var list = ((subController.Index() as ViewResult).Model as List<Resource>);
            Assert.Fail();
        }

        [TestMethod()]
        public void Subscribe_UnFollowAll_Test()
        {
            var result = subController.UnFollowAll();
            Assert.Fail();
        }

        [TestMethod()]
        public void Subscribe_FollowAllSubscribeTest()
        {
            var result = subController.UnFollowAll();
            Assert.Fail();
        }

        [TestMethod()]
        public void Subscribe_Unfollow_Test()
        {
            var result = subController.Unfollow(1);
            Assert.Fail();
        }

        [TestCleanup]
        public void Resources_CleanUpTestData()
        {
            mockResourceRepo = null;
            mockUserRepo = null;
            mockStatRepo = null;
        }
    }
}