Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Unit Tests fail in 5.0.6 #4433


User avatar
0
strix20 created
Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not instantiate Strix.Customs.Tests.Configuration.TestAppConfigurationAccessor
---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
-------- System.IO.FileNotFoundException : The configuration file 'appsettings.json' was not found and is not optional.

appsettings.json is set to copy always.

Any ideas why none of the unit tests work?


4 Answer(s)
  • User Avatar
    0
    strix20 created

    I know that it's failing in AppConfigurations.BuildConfiguration, but only in tests.

    BuildConfiguration has no issues when it gets called from the TestModule PreInitialize method?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @strix20,

    Do you run unit tests using Visual Studio's test runner or any tool like Resharper ?

  • User Avatar
    0
    strix20 created

    I tried both ReSharper and VS test runner.

    It turned out to be an issue with shadow copying, and even with ReSharper set to not shadow copy, it still would.

    I ended up having to create an xunit.runner.json in the test project and set shadowCopy: false, per this:

    <a class="postlink" href="https://xunit.github.io/docs/configuring-with-json.html">https://xunit.github.io/docs/configuring-with-json.html</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks for the feedback @strix20, it was hard to identify for us :).