public void Should_Call_JsonFactory_to_Breadcrumbs_Null_When_NotUsed()
        {
            var jsonPacketFactory = Substitute.For <IJsonPacketFactory>();

            IRavenClient ravenClient = new RavenClientTestable(TestHelper.DsnUri, jsonPacketFactory);

            ravenClient.Capture(new SentryEvent(new SentryMessage("foo")));

            jsonPacketFactory.Received().Create(Arg.Any <string>(),
                                                Arg.Is <SentryEvent>(se => se.Breadcrumbs == null));
        }
        public void Should_Call_JsonFactory_to_Breadcrumbs()
        {
            var breadcrumbsRecord = new Breadcrumb("foo");

            var jsonPacketFactory = Substitute.For <IJsonPacketFactory>();

            IRavenClient ravenClient = new RavenClientTestable(TestHelper.DsnUri, jsonPacketFactory);

            ravenClient.AddTrail(breadcrumbsRecord);

            ravenClient.Capture(new SentryEvent(new SentryMessage("foo")));

            jsonPacketFactory.Received().Create(Arg.Any <string>(),
                                                Arg.Is <SentryEvent>(se => se.Breadcrumbs.Contains(breadcrumbsRecord)));
        }
        public void Shouldnot_Register_Trails_When_IgnoreBreadcrumb()
        {
            var jsonPacketFactory = Substitute.For <IJsonPacketFactory>();

            IRavenClient ravenClient = new RavenClientTestable(TestHelper.DsnUri, jsonPacketFactory);

            ravenClient.IgnoreBreadcrumbs = true;

            ravenClient.AddTrail(new Breadcrumb("foo"));

            ravenClient.Capture(new SentryEvent(new SentryMessage("foo")));

            jsonPacketFactory.Received().Create(Arg.Any <string>(),
                                                Arg.Is <SentryEvent>(se => se.Breadcrumbs == null));
        }
        public void Should_RestartTrails_When_Call_ResetTrails()
        {
            var jsonPacketFactory = Substitute.For <IJsonPacketFactory>();

            jsonPacketFactory.Create(null, null).ReturnsForAnyArgs(new JsonPacket(""));

            IRavenClient ravenClient = new RavenClientTestable(TestHelper.DsnUri, jsonPacketFactory);

            ravenClient.AddTrail(new Breadcrumb("foo"));
            ravenClient.RestartTrails();

            ravenClient.Capture(new SentryEvent(new SentryMessage("foo")));

            jsonPacketFactory.Received().Create(Arg.Any <string>(),
                                                Arg.Is <SentryEvent>(se => se.Breadcrumbs == null));
        }