Skip to content

Conversation

@akinsmosu
Copy link

fixes #1906

  • I have read the Contribution Guidelines
  • I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors
  • The documentation was modified to reflect the changes OR no documentation changes are required.

Changes

Summary
This PR makes TextPrompt<string> case-insensitive when matching user input against defined choices. Previously, inputs such as "yes" would fail to match "Yes".

What this change does
When the TextPrompt's generic is a string and the user did not explicitly provide a comparer, it automatically configures _comparer to StringComparer.OrdinalIgnoreCase.

Adds a theory-based test to verify case-insensitive matching.

All existing behavior remains unchanged for non-string TextPrompt<T> usage.

Implementation Notes
Added a typeof(T) == typeof(string) check in TextPrompt<T> to detect string-based prompts. _comparer is set to StringComparison.OrdinalIgnoreCase only if the user does not supply a comparer.

@akinsmosu
Copy link
Author

@akinsmosu please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Copy link
Contributor

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great first PR, but there are some changes I would like to see before I merge this 👍

@akinsmosu
Copy link
Author

Thanks for the feedback! All suggestions applied.

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.

Ignore the case of the input for TextPrompt (select from multiple choices)

2 participants