Rhino Mock 与 net6

问题描述 投票:0回答:0

有没有办法让 rhino.mocks 在 .NET 6 平台的测试项目中工作?

调用下面的代码时(在 .NET 6 项目下),我总是遇到异常。

例外:

Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.'

代码:

public interface IFoo
{
    void Go();
    int Run();
}

[TestFixture]
public class UnixTest
{
    private MockRepository _repo;

    [SetUp]
    public void Setup()
    {
        _repo = new MockRepository();
    }


    [Test]
    public void Test()
    {
        var stub = _repo.StrictMock<IFoo>();
        Assert.NotNull(stub);
    }
}
c# .net .net-6.0 rhino-mocks rhino
© www.soinside.com 2019 - 2024. All rights reserved.