public void IndexMethodShouldReturnProperNumberOfProjects()
        {
            var projects = DataHelper.GetProjectData();

            var bugsRepoMock = new Mock<IRepository<Project>>();
            bugsRepoMock.Setup(x => x.All()).Returns(projects.AsQueryable());

            var uofMock = new Mock<IUnitOfWork>();
            uofMock.Setup(x => x.GetRepository<Project>()).Returns(bugsRepoMock.Object);

            var controller = new ProjectsController(uofMock.Object);
            ViewResult viewResult = controller.Index() as ViewResult;
            Assert.IsNotNull(viewResult, "Index action returns null.");
            var model = viewResult.Model as IEnumerable<ProjectViewModelEx>;
            Assert.IsNotNull(model, "The model is null.");
            var modelList = model.ToList();
            Assert.AreEqual(7, modelList.Count(), "The projects aren't 7");
        }
        public void IndexMethodShouldReturnExactlyProjectDetails()
        {
            var projects = DataHelper.GetProjectData();

            var bugsRepoMock = new Mock<IRepository<Project>>();
            bugsRepoMock.Setup(x => x.All()).Returns(projects.AsQueryable());

            var uofMock = new Mock<IUnitOfWork>();
            uofMock.Setup(x => x.GetRepository<Project>()).Returns(bugsRepoMock.Object);

            var controller = new ProjectsController(uofMock.Object);
            ViewResult viewResult = controller.Index() as ViewResult;
            Assert.IsNotNull(viewResult, "Index action returns null.");
            var model = viewResult.Model as IEnumerable<ProjectViewModelEx>;
            var modelList = model.ToList();
            Assert.IsNotNull(model, "The model is null.");
            Assert.AreEqual(7, model.Count());
            Assert.AreEqual("Accounting System", modelList[0].Name);
            Assert.AreEqual(1, modelList[0].Id);
            Assert.AreEqual(1, modelList[0].BugsCount, "The bugs count isn't 1");
            Assert.AreEqual(1, modelList[0].Bugs.Count(), "The bugs are not 1");
            Assert.AreEqual("Login form does not open.", modelList[0].Bugs.First(), "The bug title is not as expected.");
            Assert.AreEqual("Nancy Davolio", modelList[0].Manager.Name, "The manager name is not as expected");
        }