mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-15 22:29:28 +00:00
Replace Moq with NSubstitute (#51)
This commit is contained in:
+6
-8
@@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace SystemExtensions.DependencyInjection.Tests.Configuration;
|
||||
public class UpdateableOptionsResolverTests
|
||||
{
|
||||
private readonly UpdateableOptionsResolver updateableOptionsResolver = new();
|
||||
private readonly Mock<Slim.IServiceProvider> serviceProviderMock = new();
|
||||
private readonly Mock<IOptionsManager> optionsManagerMock = new();
|
||||
private readonly Slim.IServiceProvider serviceProviderMock = Substitute.For<Slim.IServiceProvider>();
|
||||
private readonly IOptionsManager optionsManagerMock = Substitute.For<IOptionsManager>();
|
||||
|
||||
[TestMethod]
|
||||
public void CanResolve_ILiveOptions_ReturnsTrue()
|
||||
@@ -41,7 +41,7 @@ public class UpdateableOptionsResolverTests
|
||||
{
|
||||
this.SetupServiceProvider();
|
||||
|
||||
var liveOptions = this.updateableOptionsResolver.Resolve(this.serviceProviderMock.Object, typeof(IUpdateableOptions<string>));
|
||||
var liveOptions = this.updateableOptionsResolver.Resolve(this.serviceProviderMock, typeof(IUpdateableOptions<string>));
|
||||
|
||||
liveOptions.Should().BeAssignableTo<IUpdateableOptions<string>>();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class UpdateableOptionsResolverTests
|
||||
|
||||
Action action = new(() =>
|
||||
{
|
||||
this.updateableOptionsResolver.Resolve(this.serviceProviderMock.Object, typeof(string));
|
||||
this.updateableOptionsResolver.Resolve(this.serviceProviderMock, typeof(string));
|
||||
});
|
||||
|
||||
action.Should().Throw<Exception>();
|
||||
@@ -61,8 +61,6 @@ public class UpdateableOptionsResolverTests
|
||||
|
||||
private void SetupServiceProvider()
|
||||
{
|
||||
this.serviceProviderMock
|
||||
.Setup(u => u.GetService<IOptionsManager>())
|
||||
.Returns(this.optionsManagerMock.Object);
|
||||
this.serviceProviderMock.GetService<IOptionsManager>().Returns(this.optionsManagerMock);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user