Skip to content

Commit

Permalink
Replace Moq with NSubstitute
Browse files Browse the repository at this point in the history
Resolves #92.
  • Loading branch information
erri120 committed Aug 11, 2023
1 parent de4fdee commit 9359689
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
9 changes: 6 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@

<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.18.0" />
<PackageVersion Include="AutoFixture.AutoMoq" Version="4.18.0" />
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.0" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="FluentAssertions.Analyzers" Version="0.21.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="FluentResults.Extensions.FluentAssertions" Version="2.1.1" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="NexusMods.Paths.TestingHelpers" Version="0.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageVersion Include="NexusMods.Paths.TestingHelpers" Version="0.1.1" />
<PackageVersion Include="NSubstitute" Version="5.0.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0">
Expand Down
7 changes: 5 additions & 2 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<ItemGroup>
<PackageReference Include="AutoFixture" />
<PackageReference Include="AutoFixture.AutoMoq" />
<PackageReference Include="AutoFixture.Xunit2" />
</ItemGroup>

Expand All @@ -21,7 +20,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Moq" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="NSubstitute.Analyzers.CSharp">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/GameFinder.Common.Tests/ExtensionTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Moq;
using NSubstitute;
using OneOf;

namespace GameFinder.Common.Tests;

public class ExtensionTests
{
private static readonly IGame Game = new Mock<IGame>().Object;
private static readonly IGame Game = Substitute.For<IGame>();
private static readonly ErrorMessage Error = new(string.Empty);

private static readonly OneOf<IGame, ErrorMessage> GameResult = OneOf<IGame, ErrorMessage>.FromT0(Game);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;
using System.Text.Json;
using AutoFixture.AutoMoq;
using GameFinder.StoreHandlers.EADesktop.Crypto;
using NexusMods.Paths;
using NSubstitute;

namespace GameFinder.StoreHandlers.EADesktop.Tests;

public partial class EADesktopTests
{
private static IHardwareInfoProvider SetupHardwareInfoProvider()
{
var fixture = new Fixture();
fixture.Customize(new AutoMoqCustomization());
return fixture.Create<IHardwareInfoProvider>();
return Substitute.For<IHardwareInfoProvider>();
}

private static (
Expand Down

0 comments on commit 9359689

Please sign in to comment.