Skip to content
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

Fixes tests which fail when run in isolation #223

Merged
merged 1 commit into from
May 24, 2023

Conversation

wwestrop
Copy link
Contributor

The following tests would fail with a null reference if they were run on their own:

  • It_returns_the_state_that_was_found_first_Example_1()
  • It_returns_the_state_that_was_found_first_Example_2()
  • It_returns_the_state_that_was_found_first_Example_3()
  • When_query_returns_false_It_raises_an_exception()

This is because SessionConfiguration is used early on in the tests, but it isn't initialised until BuildSession() is called later. When run in combination with other tests, they pass by chance, depending which other test has run before it, as in that case the SessionConfiguration is then initialised by another test.

I've added a SetUp method to ensure a fresh SessionConfiguration each test (it always uses a default one anyway). Alternatively we could swap around the order of the lines in these tests so that var session = BuildSession(....) comes before var state1 = ....

@sbowler sbowler merged commit 63ae816 into featurist:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants