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

InNamespace() is error prone due to use of StartsWith() #152

Open
mattwcole opened this issue Feb 3, 2025 · 0 comments
Open

InNamespace() is error prone due to use of StartsWith() #152

mattwcole opened this issue Feb 3, 2025 · 0 comments

Comments

@mattwcole
Copy link

Types.InNamespace(searchTerm) will incorrectly match all namespaces that start with searchTerm. For example:

namespace Orders
{
    public class Order;
}

namespace OrderSamples
{
    public class Sample;
}

public class Tests
{
    [Fact]
    public void Test()
    {
        var result = Types.InNamespace("Orders").GetTypes();
        Assert.Single(result);  // Fails as OrderSamples.Sample also matched
    }
}
NeVeSpl added a commit to NeVeSpl/NetArchTest.eNhancedEdition that referenced this issue Feb 18, 2025
…ount a string comparer specified by the user
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

No branches or pull requests

1 participant