public void when_creating_an_alert() { Exception exception = null; try { throw new ArgumentException("Generated this exception in the test"); } catch (Exception ex) { exception = ex; } Alert alert = null; context["without setting any values"] = () => { before = () => alert = new Alert(); it["ClientSummary should not be null"] = () => alert.Client.should_not_be_null(); it["Environment should not be null"] = () => alert.Environment.should_not_be_null(); it["should fail validation"] = () => expect<ExceptionalValidationException>(() => alert.Validate()); }; context["when created with an exception constructor argument"] = () => { before = () => alert = new Alert(exception); it["should have the Exception populated"] = () => alert.Exception.should_not_be_null(); it["should have the Environment set"] = () => alert.Environment.should_not_be_null(); it["should pass validation"] = () => alert.Validate(); it["should serialize"] = () => Console.WriteLine(Serializer.Serialize(alert)); //Console.WriteLine(Serializer.Serialize(alert)); }; }
public void when_connecting_to_exceptional() { var client = new ExceptionalClient(ApiKey()); var request = new HttpRequestSummary { Action = "Test", Url = "http://localhost/test", RequestMethod = "GET", Controller = "TestController", RemoteIp = "192.168.255.1", Headers = new Dictionary<string, string> { {"Version", "HTTP/1.1"}, {"User-Agent", "Test"}, }, Parameters = new Dictionary<string, string> { {"Action", "Test"}, {"Controller", "TestController"} }, Session = new Dictionary<string, string> { {"UserID", "123"}, {"demo:Person", "99883"} } }; var alert = new Alert(CreateException()); alert.Request = request; it["should report"] = () => client.Send(alert); }