Ejemplo n.º 1
0
        public void BugSplat_Post_ShouldPostExceptionToBugSplat()
        {
            try
            {
                new Foo(new Bar(new Baz())).SampleStackFrame();
            }
            catch (Exception ex)
            {
                var sut = new BugSplat("fred", "MyDotNetStandardCrasher", "1.0");
                sut.ExceptionType = BugSplat.ExceptionTypeId.Unity;
                sut.Description   = "Default description - overridden";
                sut.Email         = "[email protected] - overridden";
                sut.User          = "******";
                sut.Key           = "Default - overridden";
                var options = new ExceptionPostOptions()
                {
                    ExceptionType = BugSplat.ExceptionTypeId.DotNetStandard,
                    Description   = "BugSplat rocks!",
                    Email         = "*****@*****.**",
                    User          = "******",
                    Key           = "the key!"
                };
                options.AdditionalAttachments.Add(new FileInfo("attachment.txt"));
                var response = sut.Post(ex, options).Result;
                var body     = response.Content.ReadAsStringAsync().Result;

                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            }
        }
Ejemplo n.º 2
0
        public void BugSplat_Post_ShouldPostStackTraceToBugSplat()
        {
            var sut = new BugSplat("fred", "MyUnityCrasher", "1.0");

            sut.ExceptionType = BugSplat.ExceptionTypeId.Unity;
            sut.Description   = "Default description - overridden";
            sut.Email         = "[email protected] - overridden";
            sut.User          = "******";
            sut.Key           = "Default - overridden";
            var stackTrace = @"Exception: BugSplat rocks!
                Main.ThrowException () (at Assets/Main.cs:75)
                Main.SampleStackFrame2 () (at Assets/Main.cs:95)
                Main.SampleStackFrame1 () (at Assets/Main.cs:90)
                Main.SampleStackFrame0 () (at Assets/Main.cs:85)
                Main.GenerateSampleStackFramesAndThrow () (at Assets/Main.cs:80)
                Main.Update() (at Assets/Main.cs:69)";
            var options    = new ExceptionPostOptions()
            {
                ExceptionType = BugSplat.ExceptionTypeId.UnityLegacy,
                Description   = "BugSplat rocks!",
                Email         = "*****@*****.**",
                User          = "******",
                Key           = "the key!"
            };

            options.AdditionalAttachments.Add(new FileInfo("attachment.txt"));
            var response = sut.Post(stackTrace, options).Result;
            var body     = response.Content.ReadAsStringAsync().Result;

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }