BenMorris / NetArchTest

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

Add support for records and init-only properties #120

Open makp0 opened 1 year ago

makp0 commented 1 year ago

BeImmutable() fails on records, because IsReadonly() does not detect init only properties.

public static bool IsInitOnly(this PropertyDefinition property) => property.SetMethod.ReturnType.FullName == typeof(System.Runtime.CompilerServices.IsExternalInit).FullName;