Closed as not planned
Description
I have the following test code that works with no issues up to v3.2.2, but fails with v3.3.0 and v3.3.1 (see MsTestRegression.zip for running example):
using FsCheck;
namespace MsTestRegression;
[TestClass]
public class TestClass
{
[TestMethod]
public void TestMethod1()
{
Prop.ForAll((IEnumerable<int> x) => true).QuickCheckThrowOnFailure();
}
[AssemblyInitialize]
public static void TestInitialize(TestContext _)
{
Arb.Register<Arbitraries>();
}
}
public class Arbitraries
{
public static Arbitrary<IEnumerable<T>> EnumArb<T>() => new EnumerableArb<T>();
}
public sealed class EnumerableArb<T> : Arbitrary<IEnumerable<T>>
{
public override Gen<IEnumerable<T>> Generator => Arb.Generate<List<T>>().Select(l => (IEnumerable<T>)l);
}
(I'm using FsCheck).
When I debug the test with v3.2.2, there are no exceptions. However, when I debug the test with v3.3.0 (or v3.3.1), there are two exceptions thrown.
I think these exceptions cause the test to fail. It seems like something about loading assemblies in a method with the AssemblyInitialize
attribute has changed with v3.3.0. The actual test method TestMethod1
then fails because Arb.Register<Arbitraries>()
doesn't work as expected.
The test also fails with v3.3.0 when run from the CLI (but works with up to v3.2.2).
*) .net8
*) MSTest.TestFramework 3.3.1
*) Visual Studio 17.9.5