コード例 #1
0
        public void RemoveTest()
        {
            using (var monumentsController = new MonumentsController(new MonumentsAgent()))
            {
                monumentsController.Add(new Monument()
                {
                    Id       = 1,
                    Name     = "Monument",
                    Location = "Irak"
                });
                monumentsController.Add(new Monument()
                {
                    Id       = 2,
                    Name     = "Dom",
                    Location = "Frankrijk"
                });

                var redirectResult = monumentsController.Remove("Monument");
                var result         = ((monumentsController.Index() as ViewResult).Model) as IEnumerable <Monument>;
                Assert.IsInstanceOfType(redirectResult, typeof(RedirectToActionResult));
                Assert.AreEqual(1, result.Count());
                Assert.AreEqual("Dom", result.FirstOrDefault().Name);
                Assert.AreEqual("Frankrijk", result.FirstOrDefault().Location);
            }
        }
コード例 #2
0
        public void IndexTest()
        {
            using (var monumentsController = new MonumentsController(new MonumentsAgent()))
            {
                var result = monumentsController.Index();

                Assert.IsInstanceOfType(result, typeof(ViewResult));
            }
        }
コード例 #3
0
 public void ToevoegenMonumentTest()
 {
     using (var monumentsController = new MonumentsController(new MonumentsAgent()))
     {
         var redirectResult = monumentsController.Add(new Monument()
         {
             Name = "Monument"
         });
         var result = ((monumentsController.Index() as ViewResult).Model) as IEnumerable <Monument>;
         Assert.IsInstanceOfType(redirectResult, typeof(RedirectToActionResult));
         Assert.AreEqual(result.FirstOrDefault().Name, "Monument");
     }
 }