-
Notifications
You must be signed in to change notification settings - Fork 75
BeAssignableTo does not work across multiple layers of inheritance and multiple assemblies #320
Copy link
Copy link
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
My ArchUnit tests test for assignability across multiple layers of inheritance, like so:
// Assembly 1
public class Parent;
// Assembly 2
public class Child : Parent;
// Assembly 3
public class Grandchild : Child;
// ArchUnit test
public class Tests
{
private static readonly Architecture Architecture = new ArchLoader()
.LoadAssemblies(typeof(Parent).Assembly, typeof(Child).Assembly, typeof(Grandchild).Assembly)
.Build();
[Fact]
public void Test()
{
Classes().That().Are(typeof(Grandchild))
.Should().BeAssignableTo(typeof(Parent))
.Check(Architecture);
}
}(I created a minimal example, which you can find here: https://github.com/tnotheis/archunit-bug-example)
With version 0.11.0 this worked just fine. But since I upgraded to version 0.11.1, the test fails with the following error:
AssemblyOfGrandchild.Grandchild is not assignable to "AssemblyOfParent.Parent"
It only fails if Child and Grandchild reside in different assemblies. If you move the Grandchild class into AssemblyOfChild the test passes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.