Unplanned
Last Updated: 17 Oct 2022 12:22 by Ivo
Ivo
Created on: 17 Oct 2022 12:22
Type: Bug Report
1
Using declaration causes InvalidProgramException

if you use the C# using declaration and have JustMock advanced (elevated) mode enabled, the runtime will throw an InvalidProgramException.

Find below the sample code that demonstrates the issue:

public class TestClass : IDisposable
{
    public void Dispose()
    {
    }
}

[TestClass]
public class Fixture
{
    public interface ITest { }

    [TestMethod]
    public async Task Test()
    {
        ITest mock = Mock.Create<ITest>();
        using TestClass test = new();
    }
}

0 comments