public void Constructor_IsValid() { var profileController = new ProfileController(new Mock<IDataService<Volunteer>>().Object, new Mock<IFormsAuthenticationService>().Object); Assert.IsInstanceOf<Controller>(profileController); }
public void Edit_ReturnsView() { var formsAuthenticationService = new Mock<IFormsAuthenticationService>(); formsAuthenticationService.Setup(f => f.GetVolunteerID(null)) .Returns(Guid.NewGuid()); var volunteerDataService = new Mock<IDataService<Volunteer>>(); volunteerDataService.Setup(v => v.SelectOne(It.IsAny<Expression<Func<Volunteer, bool>>>())) .Returns(new Volunteer()); var profileController = new ProfileController(volunteerDataService.Object, formsAuthenticationService.Object); ActionResult result = profileController.Edit(); Assert.IsInstanceOf<ViewResult>(result); }
public void Index_ReturnsView() { var volunteerDataService = new Mock<IDataService<Volunteer>>(); volunteerDataService.Setup(v => v.SelectOne(It.IsAny<Expression<Func<Volunteer, bool>>>())) .Returns(new Volunteer()); var profileController = new ProfileController(volunteerDataService.Object, new Mock<IFormsAuthenticationService>().Object); ActionResult result = profileController.Index(); Assert.IsInstanceOf<ViewResult>(result); }