The CoreEx.UnitTesting
namespace extends UnitTestEx to enable CoreEx related unit testing capabilities.
To improve and simplify the unit testing of CoreEx related code.
To test ASP.NET Core Controllers using the Agent pattern, being the usage of a TypedHttpClientBase
to invoke via an HttpRequestMessage
, the following enable:
AgentTester<TAgent>
- an Agent-based tester that expects no response value.AgentTester<TAgent, TValue>
- an Agent-based tester that expects the specified responce value.
To test an IValidator
Validation().With()
extension methods are provided, extending the GenericTesterBase
. The following is an example:
GenericTester.Create<Startup>()
.ExpectErrors(
"Name is required.",
"Price must be between 0 and 100.")
.Validation().With<ProductValidator, Product>(new Product { Price = 450.95m })