Closed jnormen closed 2 weeks ago
Think I know why. seams IL treat static and abstract as same :(
Hi, unfortunately this is correct - static
classes are automatically treated as abstract
. But they are treated as sealed
as well! Therefore if you want to check only abstract
classes that are non-static
you could try the following workaround:
[Fact]
public void Abstract_Classes_Should_Have_Base_Suffix()
{
Classes()
.That()
.AreAbstract()
.And()
.AreNotSealed()
.Should().HaveNameEndingWith("Base")
.Because("It's a design rule to name the abstract classes with the suffix 'Base'.")
.Check(Architecture);
}
Please let me know if this workaround works for you. If so maybe we can further improve our Class
class :)
Cool that seams to work :) Did not know about the sealed thing. Maybe I shall check the IL more often :)
I have a test where I check if I have abstract classes if so then I want it to check if the suffix is Base. But when I run the tests it complain on my Extensions classes and my Logger (source generated once.)
Non of them are marked as abstract. What do I miss? a bug? intented?
complain:
example of an logger extension:
in this case it's partial.