Skip to content

ThatAre[Not]UnderNamespace matches partial namespaces #1196

@jnyrup

Description

@jnyrup

Description

ThatAreUnderNamespace considers a type to be under a namespace @namespace, if @namespace is a string prefix of its namespace.
That unintendedly allows a type in SystemSomething to be under the namespace System.

Complete minimal example reproducing the issue

namespace SystemPrefixed
{
    class Foo
    {
    }
}
TypeSelector types = new[] { typeof(SystemPrefixed.Foo) }.Types();

types.ThatAreUnderNamespace("System")
    .As<IEnumerable<Type>>()
    .Should()
    .BeEmpty();

Expected behavior:

Foo should not be considered to be under the namespace System.

[What actually happens]

Foo is considered to be under the namespace System.

Additional Information

First reported in #1175
Related to #1193

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions