Beispiel #1
0
        public void IndexHappyTest()
        {
            IEnumerable <Candidate> expected = new List <Candidate>
            {
                new Candidate
                {
                    Id         = 1,
                    GenotypeId = 1
                },
                new Candidate
                {
                    Id         = 2,
                    GenotypeId = 2
                }
            };

            var mockRepo = new Mock <IPlantBreedingRepo>();

            mockRepo.Setup(r => r.GetCandidates()).Returns(expected);

            var controller = new CandidatesController(mockRepo.Object);
            var response   = controller.Index() as RedirectToRouteResult;

            Assert.IsNotNull(response);
            Assert.AreEqual("List", response.RouteValues["action"]);
        }
Beispiel #2
0
        public void TestIndexView()

        {
            var        controller = new CandidatesController();
            ViewResult result     = controller.Index();

            Assert.AreEqual("Index", result.ViewName);
        }