© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago
GABRIEL22

How to fix "Assert.IsAssignableFrom() Failure: Value is null" in Xunit testing?

Hello world!

I'm writting some test for a TDD app in Asp. However when I test a Create(Post) controller, the server return me: Assert.IsAssignableFrom() Failure: Value is null.

Here's the repository:

And here's the controller:

Finally, this is the xUnit test code:

I must mention that I'm not using Moq library nor Memory database, just simple Lists. I'm not sure if this detail may help.

Anyway, I'd be really grateful if anybody could bring me some help because I'm new on this.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Assert.Raises<> in xUnit
C#CC# / help
3y ago
Extending the Assert class in xunit
C#CC# / help
2y ago
xUnit: Can't assert exceptions
C#CC# / help
3y ago