Closed kenbot closed 3 months ago
Yeah, I've had this issue previously. Just to get the tests functioning again, I just made one test that runs all the functions in order instead of having the individual tests:
https://github.com/nstlaurent/DoomLauncher/blob/development/UnitTest/Tests/TestGameFile.cs#L141
It probably should be done differently and I am good with anything that fixes the order dependencies so they run anywhere.
Hi there! Was hoping to run the tests locally, on my Visual Studio 2022 / Windows 10 so I can make some contributions.
I get a variety of errors in TestLoadFiles.cs and TestGameFile.cs that are evidently caused by the database
/UnitTest/bin/Debug/DoomLauncher.sqlite
being in the wrong state (confirmed using Sqlite DB Browser).For instance, TestGameFile adds 6 GameFiles into the DB (called "TESTxxx"), and later asserts that retrieving the list should also yield 6 entries - which fails, because it already contains things like COOLGAMEFILE.WAD, which were apparently added by TestLoadFile.
On the other hand, TestLoadFile has NullReferenceExceptions, because
CreateDatabase()
gets run in theTestFiles
test, which can't be assumed to run first.Since the build passes on Github, and your one evidently passes locally, it seems to me that my one is randomising the test order (as test frameworks typically do), whereas yours has a fixed order that you're depending on?
If my guess is correct, would you be interested in a PR that puts the tests on a stabler, more isolated footing with proper [TestInitialize] and [TestCleanup] methods?