Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.51k stars 71 forks source link

Db content isn't cleared between each test #16

Closed Aerion closed 4 years ago

Aerion commented 4 years ago

Steps to reproduce:

Expected result: the two tests should pass Actual result: one test passes, the other one fails

Assert.Equal() Failure
Expected: 0
Actual:   1
Giorgi commented 4 years ago

Yes, I didn't need the context to be cleared between tests because every call to SaveChanges throws an exception so there was no record saved to the database. If that's not the case any more obviously this test will fail. Is that an issue ?

Aerion commented 4 years ago

That's an issue for the new tests added in #15, as they need to have data first saved before checking if an exception is thrown on the second SaveChanges is called. The products names/IDs were specifically chosen to be different than the ones already specified in the tests, so it's not really a problem right now, but something to keep in mind. If in those tests a GD product name was chosen and inserted, it could make other tests fail because of the name unicity.

Giorgi commented 4 years ago

@Aerion This is fixed now. I removed the two tests that you added.