BenMorris / NetArchTest

A fluent API for .Net that can enforce architectural rules in unit tests.
MIT License
1.39k stars 82 forks source link

fix: consider types referenced by fields inside ctor base calls #77

Closed Lorilatschki closed 3 years ago

Lorilatschki commented 3 years ago

Static types refered by ctor base calls are not considered. In the following case the type BaseCtorCall has no dependency to StaticType, which in fact is wrong. Fixed by considering FieldReferences during Method visiting.

public struct Id { }

public static class StaticType
{
    public static readonly Id SomeId;
}

public abstract class BaseCtorCallBase
{
    protected BaseCtorCallBase(params Id[] ids)
    {
    }
}

public class BaseCtorCall : BaseCtorCallBase
{
    public BaseCtorCall() : base(StaticType.SomeId) { }
}