Problem
FFS0029 (MockBaseClassInstancesMustBeInternal) and FFS0030 (MockBaseClassInstancesMustBeSealed) currently fire in unit test assemblies. In FunFair.Test.Common, the MockBase<T> base classes are intentionally public and abstract so that consuming test projects in other assemblies can derive from them. They cannot be internal or sealed by design.
Currently this requires suppressions:
[SuppressMessage("FunFair.CodeAnalysis", "FFS0029: ...", Justification = "...")]
[SuppressMessage("FunFair.CodeAnalysis", "FFS0030: ...", Justification = "...")]
These suppressions themselves trigger FFS0049, which is why whitelist entries were added to SuppressMessageDiagnosticsAnalyzer. This is a layered workaround.
Solution
In ClassVisibilityDiagnosticsAnalyzer (which raises FFS0029/FFS0030), add a check for IsUnitTestAssembly() and skip both diagnostics when the compilation is a unit test assembly.
Once done, the corresponding whitelist entries for FFS0029 and FFS0030 in SuppressMessageDiagnosticsAnalyzer.AllowedSuppressions should be removed.
Problem
FFS0029(MockBaseClassInstancesMustBeInternal) andFFS0030(MockBaseClassInstancesMustBeSealed) currently fire in unit test assemblies. InFunFair.Test.Common, theMockBase<T>base classes are intentionallypublicandabstractso that consuming test projects in other assemblies can derive from them. They cannot beinternalorsealedby design.Currently this requires suppressions:
These suppressions themselves trigger
FFS0049, which is why whitelist entries were added toSuppressMessageDiagnosticsAnalyzer. This is a layered workaround.Solution
In
ClassVisibilityDiagnosticsAnalyzer(which raises FFS0029/FFS0030), add a check forIsUnitTestAssembly()and skip both diagnostics when the compilation is a unit test assembly.Once done, the corresponding whitelist entries for FFS0029 and FFS0030 in
SuppressMessageDiagnosticsAnalyzer.AllowedSuppressionsshould be removed.