public class BreaksShouldBeInterface { }
public interface BreaksShouldNotBeGeneric<T> {}
The first type breaks BeInterface() rule.
The second type breaks NotBeGeneric() rule.
When conditions are concatenated by And() function, then FailingTypes collection is empty.
In my opinion FailingTypes should contain both of the types.
I would like to use FailingTypes to fail with meaningful message explaining which of the types caused the failure.
Here is the full source to reproduce this issue:
#pragma warning disable CA1034, SA1302, SA1201
[TestFixture]
public class ArchitectureTests
{
[Test]
public void Logical_ops_check()
{
// Should() comes from FluentAssertions lib.
var result1 = Types.InAssembly(typeof(ArchitectureTests).Assembly).That().HaveNameStartingWith("BreaksShould")
.Should()
.BeInterfaces()
.GetResult();
result1.FailingTypes.Should().HaveCount(1).And.Contain(typeof(BreaksShouldBeInterface));
var result2 = Types.InAssembly(typeof(ArchitectureTests).Assembly).That().HaveNameStartingWith("BreaksShould")
.Should()
.NotBeGeneric()
.GetResult();
result2.FailingTypes.Should().HaveCount(1).And.Contain(typeof(BreaksShouldNotBeGeneric<>));
var result3 = Types.InAssembly(typeof(ArchitectureTests).Assembly).That().HaveNameStartingWith("BreaksShould")
.Should()
.BeInterfaces().And().NotBeGeneric()
.GetResult();
// Expecting FailingTypes to contain:
// - BreaksShouldBeInterface
// - BreaksShouldNotBeGeneric<T>,
// but is empty.
result3.FailingTypes.Should().HaveCount(2);
}
public class BreaksShouldBeInterface
{
}
public interface BreaksShouldNotBeGeneric<T>
{
}
}
Hello,
I'm using following code the test that the Type should meet two conditions:
I test following types:
The first type breaks BeInterface() rule. The second type breaks NotBeGeneric() rule.
When conditions are concatenated by And() function, then FailingTypes collection is empty. In my opinion FailingTypes should contain both of the types.
I would like to use FailingTypes to fail with meaningful message explaining which of the types caused the failure.
Here is the full source to reproduce this issue: