forked from datalust/seq-extensions-logging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnrichingEventTests.cs
More file actions
38 lines (31 loc) · 1.01 KB
/
EnrichingEventTests.cs
File metadata and controls
38 lines (31 loc) · 1.01 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
using Xunit;
using Serilog.Parameters;
using Serilog.Events;
using Seq.Extensions.Logging;
using Tests.Support;
namespace Tests.Seq.Extensions.Logging;
public class EnrichingEventTests
{
[Fact]
public void AddPropertyIfAbsentAddsProperties()
{
var enriching = new EnrichingEvent(
Some.EmptyLogEvent(),
new PropertyValueConverter(int.MaxValue, int.MaxValue)
);
enriching.AddPropertyIfAbsent("A", false);
enriching.AddPropertyIfAbsent("A", true);
Assert.Equal(false, ((ScalarValue)enriching.LogEvent.Properties["A"]).Value);
}
[Fact]
public void AddOrUpdatePropertyAddsProperties()
{
var enriching = new EnrichingEvent(
Some.EmptyLogEvent(),
new PropertyValueConverter(int.MaxValue, int.MaxValue)
);
enriching.AddOrUpdateProperty("A", false);
enriching.AddOrUpdateProperty("A", true);
Assert.Equal(true, ((ScalarValue)enriching.LogEvent.Properties["A"]).Value);
}
}