-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EffortException while running unit tests #42
Comments
I am having the exact same issue. vs2015, mstest |
Thank you for reporting this. It seems the problem is that the exception is still thrown when the xml configuration is set. As a workaround there should be an app config that disables this exception. |
Any workarounds? Still experiencing this issue... |
It happens to me when I use other provider in the same test project and a DbContext with this provider is initialized by test execution process before DbContext with Effort provider. I have found few workarounds:
|
Despite having the provider specified in the tl;dr version Long Version
Once the configuration has been created, trying to add a handler to the I managed to work out which test was causing the configuration to be created by adding my own handler to the Since adding the event handler can throw an exception, I had to add it to the start of every test. I just created a method and called it at the start of every test.
Then I just debugged all my tests (Test->Debug->All Tests). Once I worked out what test was causing the |
@reduckted you're right, i had a small project and i did mock a context and was doing some tests on that scenario, after you pointed this out, i could fix this problem as well, thanks. |
Is there a way to use EFFORT with an existing DataContextConfiguration? If so how. |
@JamesIlling This probably isn't the right location for a question like this, this isn't a general purpose forum. But assuming your context class has the overload exposed which accepts a connection, the following will work var connection = Effort.DbConnectionFactory.CreateTransient(); |
I have the same issue except it only happens on the build server. The tests run perfectly on my local machine. None of the solutions I have read up on work for me. Any ideas why tests won't run on a second environment? |
Now that xUnit.NET 2.0 is released, the solution is
EG:
|
Thanks, a solution to this at last! I was intermittently getting the same error when running unit tests in a TeamCity build, though the tests worked fine in Visual Studio. |
I was having this issue too in NUnit and this is what I did. I created a class file in the test project.
The project will see this file and run it before it starts the tests. |
Hi,
I'm using Effort to mock connection to my database connection. It works fine when I run single test, but when I run multiple tests I receive the following exception:
I have added mentioned configuration to app.config but it doesn't work. I can't add
RegisterProvides()
because I'm using xunit.net and it doesn't provide me any entry point.Below is my code from MyTest constructor:
The text was updated successfully, but these errors were encountered: