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"); }
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()); }
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"); }