public async void EditActionShouldReturnChallengeResult()
            {
                var logger     = new Mock <ILogger <SkiCardController> >();
                var uploader   = new Mock <IBlobFileUploadService>();
                var controller = new SkiCardController(_skiCardContext, null, _mockAuthorizationService.Object, uploader.Object, logger.Object)
                {
                    ControllerContext = _controllerContext
                };

                _mockAuthorizationService.Setup(
                    a => a.AuthorizeAsync(
                        _badGuyPrincipal,
                        _skiCard,
                        It.Is <IEnumerable <IAuthorizationRequirement> >(
                            r => r.Count() == 1 && r.First() is EditSkiCardAuthorizationRequirement)))
                .Returns(Task.FromResult(false));

                var result = await controller.Edit(new EditSkiCardViewModel
                {
                    Id = _skiCard.Id,
                    CardHolderFirstName   = "BadGuy",
                    CardHolderLastName    = "McHacker",
                    CardHolderBirthDate   = DateTime.Now.AddYears(-25),
                    CardHolderPhoneNumber = "555-555-5555"
                });

                Assert.IsType <ChallengeResult>(result);
                _mockAuthorizationService.VerifyAll();
            }
            public async Task EditActionShouldReturnNotFound()
            {
                using (SkiCardContext context =
                           new SkiCardContext(InMemoryDbContextOptionsFactory.Create <SkiCardContext>()))
                {
                    var logger     = new Mock <ILogger <SkiCardController> >();
                    var uploader   = new Mock <IBlobFileUploadService>();
                    var controller = new SkiCardController(context, null, null, uploader.Object, logger.Object);
                    var result     = await controller.Edit(new EditSkiCardViewModel
                    {
                        Id = 2,
                        CardHolderFirstName   = "Dave",
                        CardHolderLastName    = "Paquette",
                        CardHolderBirthDate   = DateTime.Now.AddYears(-99),
                        CardHolderPhoneNumber = "555-123-1234"
                    });

                    Assert.IsType <NotFoundResult>(result);
                }
            }