public HttpResponseMessage PostUserScope(UserScope userScope)
 {
     repository.Add(userScope.StartEvent());
     var result = repository.Add(userScope.StopEvent());
     var response = Request.CreateResponse(HttpStatusCode.Created, result);
     var uri = Url.Link("DefaultApi", new { controller = "UserScopes", id = result.Id });
     if (!String.IsNullOrEmpty(uri))
     {
         response.Headers.Location = new Uri(uri);
     }
     return response;
 }
 public UserScopesControllerTest()
 {
     var request = new HttpRequestMessage();
     var config = new HttpConfiguration();
     userScope = new UserScope
     {
         Feature = "Moose",
         Id = Guid.NewGuid(),
         Type = "Tick",
         Start = DateTime.Now,
         Stop = DateTime.Now
     };
     config.Routes.Add("DefaultApi", new HttpRoute("api/{controller}/{id}"));
     request.Properties["MS_HttpConfiguration"] = config;
     repository = new Mock<IUserEventRepository>(MockBehavior.Strict);
     controller = new UserScopesController(repository.Object) { Request = request };
 }