Add `RuleInfo` to `ScenarioContext`
🤔 What's changed?
Added RuleInfo to ScenarioContext.
RuleInfo will be null if no Rule is parsed.
⚡️ What's your motivation?
#452
🏷️ What kind of change is this?
- :zap: New feature (non-breaking change which adds new behaviour)
♻️ Anything particular you want feedback on?
📋 Checklist:
- [x] I've changed the behaviour of the code
- [x] I have added/updated tests to cover my changes.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] Users should know about my change
- [x] I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.
This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.
Awesome change, I'm curious how you would go about hooking this into NUnit3 to show as the name?
Just had a quick scan and it looks good, but I will do a more detailed review later. Please check the failing unit tests.
One thing that I didn't get: Why to you need the changes you had in the ObjectContainer.cs?
Please check the failing unit tests.
My bad, that shouldn't have slipped through. I have issues with the xunit tests timing out locally so I deactivated some tests.
One thing that I didn't get: Why to you need the changes you had in the ObjectContainer.cs?
Because we want RuleInfo to be null when there is no rule defined (*). I encountered errors when I didn't register anything for RuleInfo, and it wasn't possible to implicitly register anything as null. To address this, I added an explicit method (RegisterNull). I'm open to suggestions if there's another way to allow null for RuleInfo.
* I believe that RuleInfo should be null if no rule is defined because Rule is nullable in ScenarioDefinitionInFeatureFile.
Because we want
RuleInfoto benullwhen there is no rule defined (*). I encountered errors when I didn't register anything forRuleInfo, and it wasn't possible to implicitly register anything asnull. To address this, I added an explicit method (RegisterNull). I'm open to suggestions if there's another way to allownullforRuleInfo.
Thx for the clarification. Tricky indeed. I will think about that and give feedback.
@gasparnagy Thank you for the feedback, I made the changes you suggested. 👍
However I'm not really sure about the required changes to the Windsor test Resolved_scenario_context_is_the_same_for_the_same_scenario_container. Without explicitly registering a RuleInfo instance in the test it fails with Reqnroll.BoDi.ObjectContainerException : Primitive types or structs cannot be resolved: System.String (resolution path: Reqnroll.ScenarioContext->Reqnroll.RuleInfo).
Do you have any pointers here?
Do you have any pointers here?
Please change the line https://github.com/reqnroll/Reqnroll/blob/8c7c78a9c96fdc1b444ebd4844434d46aa248659/Tests/Reqnroll.PluginTests/Windsor/WindsorPluginTests.cs?plain=1#L82C1-L82C124
scenarioContainer.RegisterInstanceAs(new ScenarioInfo("", "", Array.Empty<string>(), new OrderedDictionary()));
with registering a new SecnarioContext instance:
scenarioContainer.RegisterInstanceAs(new ScenarioContext(..., new ScenarioInfo("", "", Array.Empty<string>(), new OrderedDictionary())..., ));
Maybe we could fix the breaking changes in the interfaces with default interface implementations? (And mark the old ones as [Obsolete] with a good message)
@loraderon Thank you for the contribution! According to our guidelines I have invited you to the Reqnroll "contributors team". Congrats! 🎉 If you accept it, you will be able to make pull requests easier in the future.
You are also welcome on our discord server: https://go.reqnroll.net/discord-invite