Skip to content

Commit c8cf986

Browse files
committed
added logger tests (wip #10)
1 parent 9cf4562 commit c8cf986

2 files changed

Lines changed: 401 additions & 4 deletions

File tree

Common.Mod.Test/Core/FileSystemTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Common.Mod.Test.Shims;
66
using DryIoc.ImTools;
77
using JetBrains.Annotations;
8+
using NSubstitute.Routing.Handlers;
89
using Vintagestory.API.Common;
910

1011
namespace Common.Mod.Test.Core;
@@ -145,10 +146,10 @@ public void ReadConfigFile_MissingFile_Throws()
145146
var fileName = StringUtils.Random();
146147

147148
// Act
148-
string Action() => _fileSystem.ReadConfigFile(fileName);
149+
var exception = Record.Exception(() => _fileSystem.ReadConfigFile(fileName));
149150

150151
// Assert
151-
Assert.Throws<FileNotFoundException>(Action);
152+
Assert.IsType<FileNotFoundException>(exception);
152153
}
153154

154155
[Fact]
@@ -175,10 +176,10 @@ public void ReadDataFile_MissingFile_Throws()
175176
var fileName = StringUtils.Random();
176177

177178
// Act
178-
string Action() => _fileSystem.ReadDataFile(fileName);
179+
var exception = Record.Exception(() => _fileSystem.ReadDataFile(fileName));
179180

180181
// Assert
181-
Assert.Throws<FileNotFoundException>(Action);
182+
Assert.IsType<FileNotFoundException>(exception);
182183
}
183184

184185
[Fact]

0 commit comments

Comments
 (0)