forked from SharpGenTools/SharpGenTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXUnitLogEvent.cs
More file actions
47 lines (39 loc) · 1.3 KB
/
Copy pathXUnitLogEvent.cs
File metadata and controls
47 lines (39 loc) · 1.3 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
using System;
using SharpGen.Logging;
namespace SharpGen.UnitTests;
public sealed class XUnitLogEvent : IEquatable<XUnitLogEvent>
{
public string Code { get; }
public string FullMessage { get; }
public Exception Exception { get; }
public LogLevel Level { get; }
public XUnitLogEvent(string code, string fullMessage, Exception exception, LogLevel level)
{
Code = code;
FullMessage = fullMessage;
Exception = exception;
Level = level;
}
public bool Equals(XUnitLogEvent other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Code == other.Code && FullMessage == other.FullMessage && Equals(Exception, other.Exception) && Level == other.Level;
}
public override bool Equals(object obj)
{
return ReferenceEquals(this, obj) || obj is XUnitLogEvent other && Equals(other);
}
public override int GetHashCode()
{
return HashCode.Combine(Code, FullMessage, Exception, (int) Level);
}
public static bool operator ==(XUnitLogEvent left, XUnitLogEvent right)
{
return Equals(left, right);
}
public static bool operator !=(XUnitLogEvent left, XUnitLogEvent right)
{
return !Equals(left, right);
}
}