Skip to content

Commit

Permalink
[Tests] Remove Moq as a dependency (#2522)
Browse files Browse the repository at this point in the history
This is a test-only change. I don't want to risk an upgrade and harvesting PII from anyone who works on our project, so I'm removing Moq immediately. See https://github.com/moq/moq/issues/1372 for details/discussion.
  • Loading branch information
NickCraver authored Aug 9, 2023
1 parent 7e9b900 commit 2e6b2a8
Show file tree
Hide file tree
Showing 6 changed files with 776 additions and 776 deletions.
3 changes: 1 addition & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Moq" Version="4.17.2" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.4.255" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NSubstitute" Version="4.3.0" />
<PackageVersion Include="NSubstitute" Version="5.0.0" />
<PackageVersion Include="StackExchange.Redis" Version="2.6.96" />
<!-- For binding redirect testing, main package gets this transitively -->
<PackageVersion Include="System.IO.Pipelines" Version="5.0.1" />
Expand Down
14 changes: 7 additions & 7 deletions tests/StackExchange.Redis.Tests/KeyPrefixedBatchTests.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
using Moq;
using StackExchange.Redis.KeyspaceIsolation;
using StackExchange.Redis.KeyspaceIsolation;
using System.Text;
using NSubstitute;
using Xunit;

namespace StackExchange.Redis.Tests;

[Collection(nameof(MoqDependentCollection))]
[Collection(nameof(SubstituteDependentCollection))]
public sealed class KeyPrefixedBatchTests
{
private readonly Mock<IBatch> mock;
private readonly IBatch mock;
private readonly KeyPrefixedBatch prefixed;

public KeyPrefixedBatchTests()
{
mock = new Mock<IBatch>();
prefixed = new KeyPrefixedBatch(mock.Object, Encoding.UTF8.GetBytes("prefix:"));
mock = Substitute.For<IBatch>();
prefixed = new KeyPrefixedBatch(mock, Encoding.UTF8.GetBytes("prefix:"));
}

[Fact]
public void Execute()
{
prefixed.Execute();
mock.Verify(_ => _.Execute(), Times.Once());
mock.Received(1).Execute();
}
}
Loading

0 comments on commit 2e6b2a8

Please sign in to comment.