BloggingSystem.IntegrationTests.PostsControllerIntegrationTests.TestInitialize C# (CSharp) Method

TestInitialize() private method

private TestInitialize ( ) : void
return void
        public void TestInitialize()
        {
            // Needed to load the assemlies of Services project
            PostsController postsController = new PostsController();

            transactionScope = new TransactionScope();

            var routes = new List<Route>()
            {
                new Route(
                    "PostsApi",
                    "api/posts/{postID}/{action}",
                    new 
                    { 
                        controller = "posts",
                        postID = RouteParameter.Optional,
                        action = RouteParameter.Optional 
                    }),
                new Route(
                    "UsersApi",
                    "api/users/{action}",
                    new { controller = "users" })
            };

            this.httpServer = new InMemoryHttpServer("http://localhost/", routes);

            // Register a user and user his session key for tests
            var testUser = new UserRegisterModel()
            {
                DisplayName = "Pesho Peshov",
                Username = "Peshov",
                AuthCode = "bfff2dd4f1b310eb0dbf593bd83f94dd8d34077e"
            };

            var httpResponse = this.httpServer.Post("api/users/register", testUser);
            var loggedUserModel = httpResponse.Content.ReadAsAsync<UserLoggedModel>().Result;
            this.sessionKeyHeader = new Dictionary<string, string>();
            this.sessionKeyHeader["X-sessionKey"] = loggedUserModel.SessionKey;
        }