Exemple #1
0
        private static void SimulateHttpRequest(Action <JsonPacket> test)
        {
            using (var simulator = new HttpSimulator())
            {
                simulator.SetFormVariable("Form1", "Value1")
                .SetCookie("Cookie1", "Value1")
                .SetHeader("Header1", "Value1")
                .SetReferer(new Uri("http://getsentry.com/"));

                using (simulator.SimulateRequest())
                {
                    var json = new JsonPacket(Guid.NewGuid().ToString("n"));
                    json.Request = requestFactory.Create();
                    json.User    = userFactory.Create();
                    test.Invoke(json);
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Gets the user.
 /// </summary>
 /// <returns>
 /// If an HTTP context is available, an instance of <see cref="SentryUser"/>, otherwise <c>null</c>.
 /// </returns>
 public static SentryUser GetUser(ISentryUserFactory factory)
 {
     return factory != null ? factory.Create() : null;
 }
 /// <summary>
 /// Gets the user.
 /// </summary>
 /// <returns>
 /// If an HTTP context is available, an instance of <see cref="SentryUser"/>, otherwise <c>null</c>.
 /// </returns>
 public static SentryUser GetUser(ISentryUserFactory factory)
 {
     return(factory != null?factory.Create() : null);
 }