osoftware / NSpecTestAdapter

NSpec Test Adapter for Visual Studio
MIT License
5 stars 5 forks source link

Issues with Ninject since version 0.2.1 #7

Open laynor opened 9 years ago

laynor commented 9 years ago

Before version 0.2.1, this spec was working correctly, now an error is triggered when creating a Ninject StandardKernel object

    public class describe_Foo : nspec
    {
        private int i = 0;
        private IKernel kernel;

        public void before_each()
        {
            // The next line triggers this error:
            //            An exception of type 'System.IO.DirectoryNotFoundException' 
            //            occurred in mscorlib.dll but was not handled in user code
            //
            // Additional information: Could not find a part of the path
            //  'C:\Users\ale\Documents\Visual Studio 2013\Projects\Foo-NSpecRunnerTest\Foo.Specs\packages\nspec.0.9.68\tools'.
            kernel = new StandardKernel();
            i = 10;
        }

        public void it_should_work() { i.should_be(10); }
    }

No other code is needed to replicate the bug, just create a new class library project and add this class, along with the nuget packages Ninject and NSpec, and run the tests from the test explorer.

laynor commented 8 years ago

I found a workaround disabling extension loading in ninject:

        public void before_each()
        {
            var settings = new NinjectSettings { LoadExtensions = false };
            _kernel = new StandardKernel(settings);
            _pluginManager = new PluginManager(_kernel, @"..\..\..\ExamplePlugin\bin\debug\");
        }

I found the workaround in the photon engine forum - the last post gives an insight of what is causing the issue.