Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

Commented Issue: BeOfTypeImplements to test IEnumerable instead of specific implementation (list/dictionary) [12463]

$
0
0
Unit tests for my controller include type validation of the model.
I first attempted:
ViewResult.Model.Should().BeOfType<IEnumerable<model>>()

but it failed, stating that the type is List<model>
This is true, but I don't want to worry about that during my testing... I just need to verify that the model is IEnumerable

As a result, I must use:
ViewResult.Model.GetType().Implements<IEnumerable<model>>().Should().BeTrue()

I would prefer something along the lines of:
- some sort of optional parameter for the BeOfType() to allow classes that inherit/implement T
or
- BeOfTypeImplementing<>


PS: keep up the great work... FA is probably my most frequently used nuget package :)
Comments: Is that an answer to your question?

Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>