-
Notifications
You must be signed in to change notification settings - Fork 11
Fix incorrect binding language detection and prioritization for Visual Studio extension #104
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
Merged
304NotModified
merged 4 commits into
main
from
copilot/fix-7936c092-4ee5-4ce0-ad7a-b14016a4aeb0
Aug 10, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
Tests/Reqnroll.VisualStudio.Tests/Configuration/ReqnrollConfigDeserializerTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| #nullable disable | ||
|
|
||
| using FluentAssertions; | ||
| using Reqnroll.VisualStudio.Configuration; | ||
| using Xunit; | ||
|
|
||
| namespace Reqnroll.VisualStudio.Tests.Configuration; | ||
|
|
||
| public class ReqnrollConfigDeserializerTests | ||
| { | ||
| [Fact] | ||
| public void Should_set_feature_language_from_reqnroll_json() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "language": { | ||
| "feature": "hu-HU" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("hu-HU"); | ||
| config.ConfiguredBindingCulture.Should().BeNull(); | ||
| config.BindingCulture.Should().Be("hu-HU"); // Falls back to feature language | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Should_set_binding_culture_from_reqnroll_json() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "language": { | ||
| "binding": "fr-FR" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("en-US"); // Should remain default | ||
| config.ConfiguredBindingCulture.Should().Be("fr-FR"); | ||
| config.BindingCulture.Should().Be("fr-FR"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Should_set_both_feature_and_binding_languages_from_reqnroll_json() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "language": { | ||
| "feature": "en-US", | ||
| "binding": "fr-FR" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("en-US"); | ||
| config.ConfiguredBindingCulture.Should().Be("fr-FR"); | ||
| config.BindingCulture.Should().Be("fr-FR"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Should_keep_defaults_when_no_language_configuration() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "trace": { | ||
| "stepDefinitionSkeletonStyle": "CucumberExpressionAttribute" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("en-US"); // Default | ||
| config.ConfiguredBindingCulture.Should().BeNull(); // Default | ||
| config.BindingCulture.Should().Be("en-US"); // Falls back to feature language | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Should_support_legacy_specflow_binding_culture_format() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "bindingCulture": { | ||
| "name": "de-DE" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("en-US"); // Default | ||
| config.ConfiguredBindingCulture.Should().Be("de-DE"); | ||
| config.BindingCulture.Should().Be("de-DE"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Should_prioritize_language_binding_over_legacy_bindingCulture() | ||
| { | ||
| // Arrange | ||
| var deserializer = new ReqnrollConfigDeserializer(); | ||
| var config = new DeveroomConfiguration(); | ||
| var json = """ | ||
| { | ||
| "language": { | ||
| "binding": "fr-FR" | ||
| }, | ||
| "bindingCulture": { | ||
| "name": "de-DE" | ||
| } | ||
| } | ||
| """; | ||
|
|
||
| // Act | ||
| deserializer.Populate(json, config); | ||
|
|
||
| // Assert | ||
| config.DefaultFeatureLanguage.Should().Be("en-US"); // Default | ||
| config.ConfiguredBindingCulture.Should().Be("fr-FR"); // language.binding takes priority | ||
| config.BindingCulture.Should().Be("fr-FR"); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.