Repository navigation
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates that an issue needs to be categorized.
Description
Description
I feel like AreNoConstructors should be named AreNotConstructors. It filters out methods that are not constructors, but the name "AreNoConstructors" makes it sound like a type filter filtering out types that have no constructors and makes unit tests less readable.
Minimal Working Example
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ArchUnitNET.Domain;
using ArchUnitNET.Domain.Exceptions;
using ArchUnitNETTests.AssemblyTestHelper;
using MethodMemberNamespace;
using Xunit;
using static ArchUnitNET.Fluent.ArchRuleDefinition;
namespace ArchUnitNETTests.Fluent.Syntax.Elements
{
// csharpier-ignore
public class MethodMemberSyntaxElementsTests
{
[Fact]
public async Task BeNoConstructorTest()
{
var helper = new MethodMemberAssemblyTestHelper();
helper.AddSnapshotHeader("No violations");
var should = MethodMembers().That().Are(helper.VirtualMethod).Should();
helper.AddSnapshotSubHeader("Conditions");
should.BeNoConstructor().AssertNoViolations(helper);
helper.AddSnapshotSubHeader("Predicates");
should.Be(MethodMembers().That().AreNoConstructors()).AssertNoViolations(helper);
helper.AddSnapshotHeader("Violations");
should = MethodMembers().That().Are(helper.ClassWithVirtualMethodConstructor).Should();
helper.AddSnapshotSubHeader("Conditions");
should.BeNoConstructor().AssertOnlyViolations(helper);
helper.AddSnapshotSubHeader("Predicates");
should.Be(MethodMembers().That().AreNoConstructors()).AssertOnlyViolations(helper);
helper.AddSnapshotHeader("Multiple inputs");
MethodMembers().That().Are(helper.VirtualMethod, helper.NonVirtualMethod).Should().BeNoConstructor().AssertNoViolations(helper);
MethodMembers().That().Are(helper.VirtualMethod, helper.ClassWithVirtualMethodConstructor).Should().BeNoConstructor().AssertAnyViolations(helper);
await helper.AssertSnapshotMatches();
}
}
}Expected Behavior
I expect there to be a method named AreNotConstructors that filters out members that are not a constructor.
Actual Behavior
There is only an AreNoConstructors that filters out members that are not constructors
ArchUnitNET Version
0.13.5
.NET Version
.NET 10
Additional Context
No response
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates that an issue needs to be categorized.
Activity