public void CaptureException_PacketContainingPhoneNumberLikeEventId_IsNotScrubbed()
        {
            var onCreateHttpWebRequestInvoked = false;
            var testableRavenClient           = new TestableRavenClient(this.ravenClient.CurrentDsn)
            {
                LogScrubber = new LogScrubber(),
                BeforeSend  = requester =>
                {
                    onCreateHttpWebRequestInvoked = true;
                    return(requester);
                }
            };
            string id = null;

            try
            {
                Helper.FirstLevelException();
            }
            catch (Exception exception)
            {
                id = testableRavenClient.CaptureException(exception, fingerprint: new[] { "f", "i", "n", "g", "e", "r" });
            }

            Assert.That(id, Is.Not.Null);
            Assert.That(TestHelper.Parse(id), Is.Not.Null);
            Assert.That(onCreateHttpWebRequestInvoked, Is.True);
        }
Exemplo n.º 2
0
        public async Task CaptureMessageAsync_InvokesSend_AndJsonPacketFactoryOnCreate()
        {
            var project           = Guid.NewGuid().ToString();
            var jsonPacketFactory = new TestableJsonPacketFactory(project);
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory);
            var result            = await client.CaptureMessageAsync("Test");

            Assert.That(result, Is.EqualTo(project));
        }
Exemplo n.º 3
0
        public void ErrorLevelIsDebug(Action <IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri);

            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Level, Is.EqualTo(ErrorLevel.Debug));
        }
        public async Task CaptureMessageAsync_ClientReleaseIsIgnored()
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(release : "keep-me");
            var client = new TestableRavenClient(dsnUri, jsonPacketFactory) { Release = "foobar" };
            await client.CaptureMessageAsync("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("keep-me"));
        }
Exemplo n.º 5
0
        public void CaptureMessage_InvokesSend_AndJsonPacketFactoryOnCreate()
        {
            const string dsnUri =
                "http://*****:*****@app.getsentry.com/3739";
            var project = Guid.NewGuid().ToString();
            var jsonPacketFactory = new TestableJsonPacketFactory(project);
            var client = new TestableRavenClient(dsnUri, jsonPacketFactory);
            var result = client.CaptureMessage("Test");

            Assert.That(result, Is.EqualTo(project));
        }
Exemplo n.º 6
0
        public void CaptureMessage_InvokesSend_AndJsonPacketFactoryOnCreate()
        {
            const string dsnUri =
                "http://*****:*****@app.getsentry.com/3739";
            var project           = Guid.NewGuid().ToString();
            var jsonPacketFactory = new TestableJsonPacketFactory(project);
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory);
            var result            = client.CaptureMessage("Test");

            Assert.That(result, Is.EqualTo(project));
        }
Exemplo n.º 7
0
        public async Task CaptureMessageAsync_SendsRelease()
        {
            var client = new TestableRavenClient(dsnUri)
            {
                Release = "foobar"
            };
            await client.CaptureMessageAsync("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("foobar"));
        }
Exemplo n.º 8
0
        public void SendsEnvironment(Action <IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri)
            {
                Environment = "foobar"
            };

            capture.Invoke(client);
            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Environment, Is.EqualTo("foobar"));
        }
Exemplo n.º 9
0
        public void OnlyMessageTags(Action <IRavenClient, IDictionary <string, string> > capture)
        {
            var messageTags = new Dictionary <string, string> {
                { "key", "value" }, { "foo", "bar" }
            };
            var client = new TestableRavenClient(dsnUri);

            capture.Invoke(client, messageTags);
            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 10
0
        public void CaptureMessage_SendsEnvironment()
        {
            var client = new TestableRavenClient(dsnUri)
            {
                Environment = "foobar"
            };

            client.CaptureMessage("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Environment, Is.EqualTo("foobar"));
        }
Exemplo n.º 11
0
        public void CaptureMessage_SendsRelease()
        {
            var client = new TestableRavenClient(dsnUri)
            {
                Release = "foobar"
            };

            client.CaptureMessage("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("foobar"));
        }
Exemplo n.º 12
0
        public void ClientReleaseIsIgnored(Action <IRavenClient> capture)
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(release: "keep-me");
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory)
            {
                Release = "foobar"
            };

            capture.Invoke(client);
            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("keep-me"));
        }
Exemplo n.º 13
0
        public async Task CaptureMessageAsync_ClientReleaseIsIgnored()
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(release: "keep-me");
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory)
            {
                Release = "foobar"
            };
            await client.CaptureMessageAsync("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("keep-me"));
        }
Exemplo n.º 14
0
        public void OnlyDefaultTags(Action <IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri);

            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 15
0
        public void ClientEnvironmentIsIgnored(Action <IRavenClient> capture)
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(environment: "keep-me");
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory)
            {
                Environment = "foobar"
            };

            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Environment, Is.EqualTo("keep-me"));
        }
Exemplo n.º 16
0
        public void CaptureMessage_ClientEnvironmentIsIgnored()
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(environment: "keep-me");
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory)
            {
                Environment = "foobar"
            };

            client.CaptureMessage("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Environment, Is.EqualTo("keep-me"));
        }
Exemplo n.º 17
0
        public async Task CaptureMessageAsync_OnlyDefaultTags()
        {
            var client = new TestableRavenClient(dsnUri);

            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            // client.Tags = defaultTags;
            await client.CaptureMessageAsync("Test", ErrorLevel.Info);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 18
0
        public void CaptureMessage_ClientLoggerIsIgnored()
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(logger: "keep-me");
            var client            = new TestableRavenClient(dsnUri, jsonPacketFactory)
            {
                Logger = "foobar"
            };

            client.CaptureMessage("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Logger, Is.EqualTo("keep-me"));
        }
Exemplo n.º 19
0
        public async Task CaptureMessageAsync_OnlyMessageTags()
        {
            var messageTags = new Dictionary <string, string> {
                { "key", "value" }, { "foo", "bar" }
            };

            var client = new TestableRavenClient(dsnUri);
            await client.CaptureMessageAsync("Test", ErrorLevel.Info, messageTags);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 20
0
        public void CaptureMessage_TagHandling()
        {
            var messageTags = new Dictionary <string, string> {
                { "key", "another value" }
            };

            var client = new TestableRavenClient(dsnUri);

            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            client.CaptureMessage("Test", ErrorLevel.Info, messageTags);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("another value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 21
0
        public void TagHandling(Action<IRavenClient, IDictionary<string, string>> capture)
        {
            var messageTags = new Dictionary<string, string> { { "key", "another value" } };

            var client = new TestableRavenClient(dsnUri);
            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            capture.Invoke(client, messageTags);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("another value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 22
0
        public void SendsRelease(Action<IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri) { Release = "foobar" };
            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("foobar"));
        }
Exemplo n.º 23
0
        public void ErrorLevelIsDebug(Action<IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri);
            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Level, Is.EqualTo(ErrorLevel.Debug));
        }
        public async Task CaptureMessageAsync_SendsRelease()
        {
            var client = new TestableRavenClient(dsnUri) { Release = "foobar" };
            await client.CaptureMessageAsync("Test");

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("foobar"));
        }
        public async Task CaptureMessageAsync_TagHandling()
        {
            var messageTags = new Dictionary<string, string> { { "key", "another value" } };

            var client = new TestableRavenClient(dsnUri);
            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            await client.CaptureMessageAsync("Test", ErrorLevel.Info, messageTags);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("another value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 26
0
        public void OnlyDefaultTags(Action<IRavenClient> capture)
        {
            var client = new TestableRavenClient(dsnUri);
            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }
Exemplo n.º 27
0
        public void ClientEnvironmentIsIgnored(Action<IRavenClient> capture)
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(environment : "keep-me");
            var client = new TestableRavenClient(dsnUri, jsonPacketFactory) { Environment = "foobar" };
            capture.Invoke(client);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Environment, Is.EqualTo("keep-me"));
        }
        public async Task CaptureMessageAsync_InvokesSend_AndJsonPacketFactoryOnCreate()
        {
            var project = Guid.NewGuid().ToString();
            var jsonPacketFactory = new TestableJsonPacketFactory(project);
            var client = new TestableRavenClient(dsnUri, jsonPacketFactory);
            var result = await client.CaptureMessageAsync("Test");

            Assert.That(result, Is.EqualTo(project));
        }
Exemplo n.º 29
0
        public void ClientReleaseIsIgnored(Action<IRavenClient> capture)
        {
            var jsonPacketFactory = new TestableJsonPacketFactory(release : "keep-me");
            var client = new TestableRavenClient(dsnUri, jsonPacketFactory) { Release = "foobar" };
            capture.Invoke(client);
            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Release, Is.EqualTo("keep-me"));
        }
        public async Task CaptureMessageAsync_OnlyDefaultTags()
        {
            var client = new TestableRavenClient(dsnUri);
            client.Tags.Add("key", "value");
            client.Tags.Add("foo", "bar");
            // client.Tags = defaultTags;
            await client.CaptureMessageAsync("Test", ErrorLevel.Info);

            var lastEvent = client.LastPacket;

            Assert.That(lastEvent.Tags["key"], Is.EqualTo("value"));
            Assert.That(lastEvent.Tags["foo"], Is.EqualTo("bar"));
        }