Exemplo n.º 1
0
        public void Constructor_IsValid()
        {
            var profileController = new ProfileController(new Mock<IDataService<Volunteer>>().Object,
                                                          new Mock<IFormsAuthenticationService>().Object);

            Assert.IsInstanceOf<Controller>(profileController);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }