示例#1
0
        public void ListOfPerson()
        {
            PersonController personController = new PersonController(mockPersonService.Object);

            ActionResult result = personController.ListOfPerson();
            mockPersonService.Verify(m => m.GetList());


            Assert.IsInstanceOfType(result, typeof(PartialViewResult));
            Assert.IsNotNull(result);
            // Assert.AreEqual((result as ViewResult).ViewName, "Index");
        }
示例#2
0
        public void Create()
        {
            PersonController personController = new PersonController(mockPersonService.Object);

            var result = personController.Create(It.IsAny<PersonViewModel>());
            mockPersonService.Verify(m => m.AddAsync(It.IsAny<PersonViewModel>()));


            Assert.IsInstanceOfType(result, typeof(Task<ActionResult>));
            Assert.IsNotNull(result);
           Assert.AreEqual("Index", (result.Result as RedirectToRouteResult).RouteValues.Values.FirstOrDefault());
        }
示例#3
0
        public void GetAllTest()
        {
            PersonController personController = new PersonController(mockPersonService.Object);

            var result =personController.Index();
            mockPersonService.Verify(m => m.GetList());

            
            Assert.IsInstanceOfType(result, typeof(ViewResult));
            Assert.IsNotNull(result);
  //       Assert.AreEqual((result as ViewResult).ViewName, "Index");
        }