Skip to content

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

@mattwcole

Description

@mattwcole

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
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions