public void AddPostValidModel_ReturnsRedirect()
        {
            var volunteerFake = new Volunteer
                                    {
                                        Id = Guid.NewGuid(),
                                    };

            var recipientFake = new Recipient
                                    {
                                        Active = true,
                                        FirstName = "Dan",
                                        Id = Guid.NewGuid(),
                                    };

            var dataServiceMock = new Mock<IDataService<Recipient>>();
            dataServiceMock.Setup(d => d.Insert(It.IsAny<Recipient>(), It.IsAny<Guid>())).Verifiable();

            var formsAuthenticationServiceMock = new Mock<IFormsAuthenticationService>();
            formsAuthenticationServiceMock.Setup(f => f.GetVolunteerID(null))
                .Returns(volunteerFake.Id);

            var controller = new RecipientController(dataServiceMock.Object,
                                                     new Mock<IDataService<Volunteer>>().Object,
                                                     formsAuthenticationServiceMock.Object);

            ActionResult result = controller.Add(recipientFake);

            dataServiceMock.VerifyAll();

            Assert.IsInstanceOf(typeof (RedirectToRouteResult), result);
        }
        public void AddPostInvalidModel_ReturnsView()
        {
            var controller = new RecipientController(new Mock<IDataService<Recipient>>().Object,
                                                     new Mock<IDataService<Volunteer>>().Object,
                                                     new Mock<IFormsAuthenticationService>().Object);

            controller.ModelState.AddModelError("test", "error");

            ActionResult result = controller.Add(new Recipient());

            Assert.IsInstanceOf(typeof (ViewResult), result);
        }
        public void Add_ReturnsView()
        {
            var controller = new RecipientController(new Mock<IDataService<Recipient>>().Object,
                                                     new Mock<IDataService<Volunteer>>().Object,
                                                     new Mock<IFormsAuthenticationService>().Object);
            ActionResult result = controller.Add();

            Assert.IsInstanceOf(typeof (ViewResult), result);
        }