bilal-fazlani / commanddotnet

A modern framework for building modern CLI apps
https://commanddotnet.bilal-fazlani.com
MIT License
575 stars 29 forks source link

Decouple FluentAssertion from TestTools #265

Closed drewburlingame closed 4 years ago

drewburlingame commented 4 years ago

TestTools is tightly coupled to FluentAssertion to validate TestCaptures and Output values. The tight-coupling makes it difficult for consumers of the package to use other libraries like Shouldly because intellisense will suggest both. It also tightly couples consumers to major versions of FluentValidation.

String validation is easy to replace by throwing exceptions.

TestCaptures is more complicated to replace because the ShouldBeEquivalentTo check is non-trivial. TestCaptures is likely used only by this framework. I'd be interested to hear from anyone who's using it. With recent updates to the TestTools, there are other ways to perform that type of validation so we could deprecate the feature and suggest alternatives, making TestCaptures specific to our framework. Something more useful may be an extension method to get the IArgument and invocation details for a given parameter/property by name. With that, devs can create assertions on those values to verify custom middleware works as expected.

Any other thoughts on how to approach this?

drewburlingame commented 4 years ago

Implementing a simple ShouldBeEquivalentTo turned out to be trivial enough so that's what I went for.

drewburlingame commented 4 years ago

fixed with #266