Skip to content

Add Assert StartsWith/DoesNotStartWith, EndsWith/DoesNotEndsWith, Mat… #5768

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Evangelink
Copy link
Member

…chesRegex/DoesNotMatchRegex

@Evangelink
Copy link
Member Author

@copilot can you add unit tests for these?

@Evangelink Evangelink requested a review from Copilot June 13, 2025 10:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a set of new string assertion methods to the test framework, covering prefix, suffix, and regular expression matching validations. Key changes include the addition of StartsWith/DoesNotStartWith, EndsWith/DoesNotEndWith, and MatchesRegex/DoesNotMatchRegex assertion APIs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/TestFramework/TestFramework/Assertions/Assert.StartsWith.cs Adds assertions for checking if a string starts with a given substring.
src/TestFramework/TestFramework/Assertions/Assert.Matches.cs Introduces assertions for regex matching and non-matching validations.
src/TestFramework/TestFramework/Assertions/Assert.EndsWith.cs Provides assertions for verifying suffix conditions of strings.
Comments suppressed due to low confidence (1)

src/TestFramework/TestFramework/Assertions/Assert.Matches.cs:155

  • The summary for DoesNotMatchRegex uses 'MatchesRegex' in its description, which may cause confusion. Consider updating the text to clarify that the exception is thrown when the string actually matches the regular expression.
/// Tests whether the specified string does not match a regular expression and throws an exception if the string MatchesRegex the expression.

@Evangelink Evangelink enabled auto-merge (squash) June 16, 2025 20:35
# Conflicts:
#	src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt
#	src/TestFramework/TestFramework/Resources/FrameworkMessages.resx
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.

1 participant