-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
VersionEnricherTests.cs
38 lines (31 loc) · 1.04 KB
/
VersionEnricherTests.cs
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 System;
using FluentAssertions;
using HappyCode.NetCoreBoilerplate.Api.Infrastructure.Logging;
using HappyCode.NetCoreBoilerplate.Core.Providers;
using Serilog.Events;
using Xunit;
namespace HappyCode.NetCoreBoilerplate.Api.UnitTests.Infrastructure.Logging;
public class VersionEnricherTests
{
private readonly VersionEnricher _sut;
public VersionEnricherTests()
{
_sut = new VersionEnricher(new VersionProvider());
}
[Fact]
public void Properties_should_be_available()
{
// Arrange
var logEvent = GetEmptyLogEvent();
// Act
_sut.Enrich(logEvent, null);
// Assert
logEvent.Properties["SHA"].ToString().Should().Contain("36b90293");
logEvent.Properties["VERSION"].ToString().Should().Contain("9.9.9");
}
private static LogEvent GetEmptyLogEvent()
{
return new LogEvent(DateTimeOffset.UtcNow, LogEventLevel.Verbose, null,
new MessageTemplate(Guid.NewGuid().ToString(), []), []);
}
}