Esempio n. 1
0
        public void Admin_WhenThereAreNoCompetitions_ReturnAnEmptyListOfCompetitions()
        {
            var controller = new CompetitionController();

            controller.CompetitionRepository = new CompetitionRepository {
                QueryableSession = new InMemoryQueryableSession <Competition>()
            };

            var result = controller.Admin() as ViewResult;

            Assert.IsNotNull(result);
            var model = result.Model as IList <Competition>;

            Assert.IsNotNull(model);
            Assert.AreEqual(0, model.Count);
        }
Esempio n. 2
0
        public void Admin_WhenExistsAtLeastACompetition_ShowListOfExistentCompetitions()
        {
            var competition = new Competition();
            var compRep     = new CompetitionRepository {
                QueryableSession = new InMemoryQueryableSession <Competition>()
            };

            compRep.Add(competition);

            var controller = new CompetitionController();

            controller.CompetitionRepository = compRep;
            var result = controller.Admin() as ViewResult;

            Assert.IsNotNull(result);
            var model = result.Model as IList <Competition>;

            Assert.IsNotNull(model);
            Assert.IsTrue(model.Contains(competition));
        }