Blog.Common.Web.Tests.Attributes.BlogApiAuthorizationAttributeTest.TestInit C# (CSharp) Method

TestInit() private method

private TestInit ( ) : void
return void
        public void TestInit()
        {
            _principal = new Mock<IPrincipal>();
            _httpActionDescriptor = new Mock<HttpActionDescriptor>();

            _controller = new TestController();
            _httpConfiguration = new HttpConfiguration();
            _httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, "http://localhost/api/test");
            _httpRoute = _httpConfiguration.Routes.MapHttpRoute("test", "api/{controller}/{id}");
            _httpRouteData = new HttpRouteData(_httpRoute, new HttpRouteValueDictionary { { "controller", "test" } });

            _controller.ControllerContext = new HttpControllerContext(_httpConfiguration, _httpRouteData, _httpRequestMessage);
            _controller.Request = _httpRequestMessage;
            _controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = _httpConfiguration;

            _httpActionContext = new HttpActionContext(_controller.ControllerContext, _httpActionDescriptor.Object);
        }