-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathRaygunClientBaseTests.cs
More file actions
62 lines (54 loc) · 1.76 KB
/
RaygunClientBaseTests.cs
File metadata and controls
62 lines (54 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mindscape.Raygun4Net.Messages;
using NUnit.Framework;
namespace Mindscape.Raygun4Net.Tests
{
[TestFixture]
public class RaygunClientBaseTests
{
private FakeRaygunClient _client = new FakeRaygunClient();
[Test]
public void FlagAsSentDoesNotCrash_DataDoesNotSupportStringKeys()
{
Assert.That(() => _client.ExposeFlagAsSent(new FakeException(new Dictionary<int, object>())), Throws.Nothing);
}
[Test]
public void FlagAsSentDoesNotCrash_NullData()
{
Assert.That(() => _client.ExposeFlagAsSent(new FakeException(null)), Throws.Nothing);
}
[Test]
public void CanSendIfDataIsNull()
{
Assert.IsTrue(_client.ExposeCanSend(new FakeException(null)));
}
[Test]
public void CannotSendSentException_StringDictionary()
{
Exception exception = new FakeException(new Dictionary<string, object>());
_client.ExposeFlagAsSent(exception);
Assert.IsFalse(_client.ExposeCanSend(exception));
}
[Test]
public void CannotSendSentException_ObjectDictionary()
{
Exception exception = new FakeException(new Dictionary<object, object>());
_client.ExposeFlagAsSent(exception);
Assert.IsFalse(_client.ExposeCanSend(exception));
}
[Test]
public void ExceptionInsideSendingMessageHAndlerDoesNotCrash()
{
FakeRaygunClient client = new FakeRaygunClient();
client.SendingMessage += (sender, args) =>
{
throw new Exception("Oops...");
};
Assert.That(() => client.ExposeOnSendingMessage(new RaygunMessage(), new Exception()), Throws.Nothing);
Assert.IsTrue(client.ExposeOnSendingMessage(new RaygunMessage(), new Exception()));
}
}
}