public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            config.Formatters.JsonFormatter.SupportedMediaTypes
            .Add(new MediaTypeHeaderValue("text/html"));
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

            using (var ctx = new MicroBlogContext())
            {
                ctx.SaveChanges();
            }
        }
Beispiel #2
0
 public PostsControllerTests()
 {
     //Arrange
     this.microBlogContext = new MicroBlogContext();
     this.postController   = new PostsController(microBlogContext);
 }
 public AuthorsControllerTests()
 {
     //Arrange
     this.microBlogContext = new MicroBlogContext();
     this.authorController = new AuthorsController(microBlogContext);
 }
Beispiel #4
0
 public AuthorsController(MicroBlogContext microBlogContext)
 {
     this.microBlogContext = microBlogContext;
 }
 public PostsController(MicroBlogContext microBlogContext)
 {
     this.microBlogContext = microBlogContext;
 }