-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathSnippets.cs
49 lines (39 loc) · 1.14 KB
/
Snippets.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
39
40
41
42
43
44
45
46
47
48
49
using NUnit.Framework;
using Serilog;
namespace Destructurama.Attributed.Tests;
#region WithRegex
public class WithRegex
{
private const string REGEX_WITH_VERTICAL_BARS = @"([a-zA-Z0-9]+)\|([a-zA-Z0-9]+)\|([a-zA-Z0-9]+)";
/// <summary>
/// 123|456|789 results in "***|456|789"
/// </summary>
[LogReplaced(REGEX_WITH_VERTICAL_BARS, "***|$2|$3")]
public string? RegexReplaceFirst { get; set; }
/// <summary>
/// 123|456|789 results in "123|***|789"
/// </summary>
[LogReplaced(REGEX_WITH_VERTICAL_BARS, "$1|***|$3")]
public string? RegexReplaceSecond { get; set; }
}
#endregion
public class Snippets
{
#region LoginCommand
public class LoginCommand
{
public string? Username { get; set; }
[NotLogged]
public string? Password { get; set; }
}
#endregion
private static readonly ILogger _log = Log.ForContext<Snippets>();
[Test]
public void LogCommand()
{
#region LogCommand
var command = new LoginCommand { Username = "logged", Password = "not logged" };
_log.Information("Logging in {@Command}", command);
#endregion
}
}