machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

NCrunch tests run failed after updating to 1.1.0 #475

Closed timurnes closed 2 years ago

timurnes commented 2 years ago

I am encountering tests errors using NCrunch after updating Machine.Specifications package from 1.0.0 to 1.1.0 All tests, even such simple, fail with exception

public class when_test
{
    Establish context = () =>
        _result = false;

    Because of = () =>
        _result = true;

    It should_set_result_to_true = () =>
        _result.ShouldBeTrue();

    static bool _result;
}

The exception is:

System.Exception: Unable to find framework method 'FindContexts'.  The most likely cause for this is that you are using a version of a test framework that NCrunch has not been designed to handle.
   at nCrunch.Module.MSpec.Integration.ReflectedMSpecType.getMethodUsingReflection(Type targetType, String methodName, Type[] typeNames)
   at nCrunch.Module.MSpec.Integration.ReflectedMSpecType.getMethodUsingReflection(String methodName, Type[] typeNames)
   at nCrunch.Module.MSpec.Integration.ReflectedMSpecType.invokeMethod(String methodName, Type[] paramTypes, Object[] methodParams)
   at nCrunch.Module.MSpec.Integration.ReflectedAssemblyExplorer.FindContexts(Type type)
   at nCrunch.Module.MSpec.Integration.MSpecFrameworkRuntimeEnvironment.getContextsToExecute(TestExecutionMonitor monitor, ReflectedAssemblyExplorer explorer, TestTaskOutput output)+MoveNext()

As of now, I've downgraded to previous version (1.0.0) to fix this. Resharper test runner works fine on both package versions

robertcoltheart commented 2 years ago

This is an issue on the side of NCrunch, not much I can do on the MSpec side of things. I'd suggest raising an issue over at the NCrunch forums.