Replace Moq with NSubstitute (#51)

This commit is contained in:
2023-08-09 16:11:11 +02:00
committed by GitHub
parent fe049d4c00
commit b7244b2bdb
13 changed files with 101 additions and 132 deletions
@@ -1,6 +1,6 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NSubstitute;
using System.Logging;
namespace SystemExtensions.DependencyInjection.Tests.Logging;
@@ -8,13 +8,13 @@ namespace SystemExtensions.DependencyInjection.Tests.Logging;
[TestClass]
public class CVLoggerProviderTests
{
private readonly Mock<ILogsWriter> logsWriterMock = new();
private readonly ILogsWriter logsWriterMock = Substitute.For<ILogsWriter>();
private CVLoggerProvider cVLoggerProvider;
[TestInitialize]
public void TestInitialize()
{
this.cVLoggerProvider = new CVLoggerProvider(this.logsWriterMock.Object);
this.cVLoggerProvider = new CVLoggerProvider(this.logsWriterMock);
}
[TestMethod]
@@ -30,13 +30,6 @@ public class CVLoggerProviderTests
{
this.cVLoggerProvider.LogEntry(new Log());
this.logsWriterMock.Verify();
}
private void SetupLogsWriter()
{
this.logsWriterMock
.Setup(u => u.WriteLog(It.IsAny<Log>()))
.Verifiable();
this.logsWriterMock.ReceivedWithAnyArgs().WriteLog(Arg.Any<Log>());
}
}