forked from destructurama/attributed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snippets.cs
50 lines (41 loc) · 1.25 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
50
using NUnit.Framework;
using Serilog;
namespace Destructurama.Attributed.Tests
{
#region WithRegex
public class WithRegex
{
const string RegexWithVerticalBars = @"([a-zA-Z0-9]+)\|([a-zA-Z0-9]+)\|([a-zA-Z0-9]+)";
/// <summary>
/// 123|456|789 results in "***|456|789"
/// </summary>
[LogReplaced(RegexWithVerticalBars, "***|$2|$3")]
public string? RegexReplaceFirst { get; set; }
/// <summary>
/// 123|456|789 results in "123|***|789"
/// </summary>
[LogReplaced(RegexWithVerticalBars, "$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
static 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
}
}
}