public void WithAuthenticatedUserUsingPrincipalShouldWorkCorrectly()
        {
            var controllerBuilder = MyWebApi
                                    .Controller <WebApiController>();

            controllerBuilder
            .WithAuthenticatedUser(TestObjectFactory.GetClaimsPrincipal())
            .Calling(c => c.AuthorizedAction())
            .ShouldReturn()
            .NotFound();

            var controllerUser = controllerBuilder.AndProvideTheController().User;

            Assert.AreEqual("CustomUser", controllerUser.Identity.Name);
            Assert.AreEqual(null, controllerUser.Identity.AuthenticationType);
            Assert.IsFalse(controllerUser.Identity.IsAuthenticated);
        }
        public void WithSetupShouldSetCorrectPropertiesToController()
        {
            var actionContext = new HttpActionContext();
            var user          = TestObjectFactory.GetClaimsPrincipal();
            var config        = new HttpConfiguration();

            var controller = MyWebApi
                             .Controller <WebApiController>()
                             .WithSetup(c =>
            {
                c.ActionContext = actionContext;
                c.User          = user;
                c.Configuration = config;
            })
                             .AndProvideTheController();

            Assert.NotNull(controller);
            Assert.AreSame(actionContext, controller.ActionContext);
            Assert.AreSame(user, controller.User);
            Assert.AreSame(config, controller.Configuration);
        }