public async Task<ActionResult> Index(Guid id)
        {
            var movementDate = await mediator.SendAsync(new GetMovementDateByMovementId(id));

            var viewModel = new DateReceivedViewModel(movementDate);

            return View(viewModel);
        }
        public ActionResult Index(Guid id, DateReceivedViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            TempData[DateReceivedKey] = viewModel.GetDateReceived();

            return RedirectToAction("Index", "QuantityReceived", new { id });
        }
        public void DateAfterMovementDatePasses()
        {
            var viewModel = new DateReceivedViewModel
            {
                MovementDate = MovementDate,
                Day = 1,
                Month = 1,
                Year = 2016
            };

            Assert.Empty(ViewModelValidator.ValidateViewModel(viewModel));
        }
        public void DateBeforeMovementDateFails()
        {
            var viewModel = new DateReceivedViewModel
            {
                MovementDate = MovementDate,
                Day = 1,
                Month = 8,
                Year = 2015
            };

            Assert.NotEmpty(ViewModelValidator.ValidateViewModel(viewModel));
        }
        public void InvalidDateCombinationFails(int day, int month, int year)
        {
            var viewModel = new DateReceivedViewModel
            {
                MovementDate = MovementDate,
                Day = day,
                Month = month,
                Year = year
            };

            Assert.NotEmpty(ViewModelValidator.ValidateViewModel(viewModel));
        }
        public void PostRedirectsToCorrectScreen()
        {
            var viewModel = new DateReceivedViewModel
            {
                Day = DateReceived.Day,
                Month = DateReceived.Month,
                Year = DateReceived.Year
            };

            var result = controller.Index(MovementId, viewModel);

            Assert.IsType<RedirectToRouteResult>(result);

            var redirectResult = result as RedirectToRouteResult;

            RouteAssert.RoutesTo(redirectResult.RouteValues, "Index", "QuantityReceived");
        }