I try to use FluentAssertions to check in my UnitTest, that the type of a property in a list of items is of a certain type.
myObj.Items.OfType<TypeA>().Single()
.MyProperty1.GetType()
.Should().BeOfType<TypeB>();
Unfortunately, my test fails with the following error message:
Expected type to be TypeB, but found System.RuntimeType.
Why does it say, that it found System.RuntimeType
? I used the debugger to verify, that MyProperty1
is of type TypeB
and it is... am I using .BeOfType<>
wrong?
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire