-
Notifications
You must be signed in to change notification settings - Fork 96
/
ModLoggerTest.cs
54 lines (44 loc) · 1.37 KB
/
ModLoggerTest.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
51
52
53
54
using System;
using Xunit;
using NSubstitute;
using UnityEngine;
using ModuleManager.Logging;
namespace ModuleManagerTests.Logging
{
public class ModLoggerTest
{
private ILogger innerLogger;
private ModLogger logger;
public ModLoggerTest()
{
innerLogger = Substitute.For<ILogger>();
logger = new ModLogger("MyMod", innerLogger);
}
[Fact]
public void TestLog__Info()
{
logger.Log(LogType.Log, "well hi there");
innerLogger.Received().Log(LogType.Log, "[MyMod] well hi there");
}
[Fact]
public void TestLog__Warning()
{
logger.Log(LogType.Warning, "I'm warning you");
innerLogger.Received().Log(LogType.Warning, "[MyMod] I'm warning you");
}
[Fact]
public void TestLog__Error()
{
logger.Log(LogType.Error, "You have made a grave mistake");
innerLogger.Received().Log(LogType.Error, "[MyMod] You have made a grave mistake");
}
[Fact]
public void TestException()
{
Exception e = new Exception();
logger.Exception("An exception was thrown", e);
innerLogger.Received().Log(LogType.Error, "[MyMod] An exception was thrown");
innerLogger.Received().LogException(e);
}
}
}