forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityLoggerTest.cs
More file actions
58 lines (48 loc) · 1.36 KB
/
Copy pathUnityLoggerTest.cs
File metadata and controls
58 lines (48 loc) · 1.36 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
48
49
50
51
52
53
54
55
56
57
58
using System;
using Xunit;
using NSubstitute;
using UnityEngine;
using ModuleManager.Extensions;
using ModuleManager.Logging;
namespace ModuleManagerTests.Logging
{
public class UnityLoggerTest
{
private readonly ILogger innerLogger = Substitute.For<ILogger>();
private readonly UnityLogger logger;
public UnityLoggerTest()
{
logger = new UnityLogger(innerLogger);
}
[Fact]
public void TestConstructor__LoggerNull()
{
ArgumentNullException e = Assert.Throws<ArgumentNullException>(delegate
{
new UnityLogger(null);
});
Assert.Equal("logger", e.ParamName);
}
[Fact]
public void TestLog__Info()
{
logger.Info("well hi there");
innerLogger.Received().Log(LogType.Log, "well hi there");
}
[Fact]
public void TestLog__Warning()
{
logger.Warning("I'm warning you");
innerLogger.Received().Log(LogType.Warning, "I'm warning you");
}
[Fact]
public void TestLog__MessageNull()
{
ArgumentNullException e = Assert.Throws<ArgumentNullException>(delegate
{
logger.Log(null);
});
Assert.Equal("message", e.ParamName);
}
}
}