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

Class member referring a local enum incorrectly results as an external dependency #148

Open
jonataspc opened this issue Nov 19, 2024 · 1 comment

Comments

@jonataspc
Copy link

jonataspc commented Nov 19, 2024

The following code results false:

using NetArchTest.Rules;

var result = Types.InCurrentDomain()
                  .That()
                  .HaveNameStartingWith("MyClass")
                  .Should()
                  .OnlyHaveDependenciesOn("System", "NetArchTestLabs")
                  .GetResult();

Console.WriteLine(result.IsSuccessful); // should be true

namespace NetArchTestLabs
{
    public static class MyClass
    {
        private static readonly MyEnum[] _values = { MyEnum.A, MyEnum.B, MyEnum.C };
    }

    public enum MyEnum
    {
        D,
        A,
        B,
        C,
        Z
    }
}

Am I missing something here or is it expected?
If I remove the first element of the enum, weirdly it behaves as expected, resulting true.

Here is a reproducible example:
https://github.com/jonataspc/NetArchTestLabs

@NeVeSpl
Copy link
Contributor

NeVeSpl commented Nov 20, 2024

That is unexpected, of course. PR #102 fixed it, but a new version of NetArchTest has not been released since then.

You can check NetArchTest.eNhancedEdition, all known problems are fixed there.

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

2 participants