public void Assign_BadDateRange_ReturnsIndexView()
        {
            // Arrange
            var disaster = new Mock<IDisaster>();
            var volunteer = new Mock<IVolunteerService>();
            var webSecurity = new Mock<IWebSecurityWrapper>();

            var controller = new HomeController(disaster.Object, volunteer.Object, webSecurity.Object);

            disaster.Setup(x => x.AssignToVolunteer(
                It.IsAny<int>(),
                It.IsAny<int>(),
                It.IsAny<DateTime>(),
                It.IsAny<DateTime>())).Throws(new ArgumentException(""));

            volunteer.Setup(x => x.FindByUserId(It.IsAny<int>())).Returns(new Person());
            webSecurity.SetupGet(x => x.CurrentUserId).Returns(10);

            // Act
            var viewModel = new VolunteerViewModel { SelectedStartDate = DateTime.Today.AddDays(1) };
            var response = controller.Assign(viewModel);

            // Assert
            var view = response as ViewResult;
            Assert.IsTrue(view.ViewName.Equals("Index"));
            Assert.IsTrue(view.ViewData.ModelState.Count >= 1);
        }
        public void Assign_ValidDateRange_RedirectsToHome()
        {
            // Arrange
            var disaster = new Mock<IDisaster>();
            var volunteer = new Mock<IVolunteerService>();
            var webSecurity = new Mock<IWebSecurityWrapper>();
            volunteer.Setup(service => service.FindByUserId(It.IsAny<int>())).Returns(new Person());
            var controller = new HomeController(disaster.Object, volunteer.Object, webSecurity.Object);

            // Act
            var viewModel = new VolunteerViewModel { SelectedStartDate = DateTime.Today.AddDays(1) };
            var response = controller.Assign(viewModel);

            // Assert
            var result = response as RedirectResult;
            Assert.IsTrue(result.Url.ToLower().Contains("home"));
        }