Open fabiocav opened 3 years ago
How did you define MockBindingContext ?
It's pretty straightforward:
public class MockBindingContext : BindingContext
{
public MockBindingContext(IReadOnlyDictionary<string, object?> bindingData)
{
BindingData = bindingData;
}
public override IReadOnlyDictionary<string, object?> BindingData { get; }
}
To support unit testing, both ASP.NET Web APIs and Azure Functions (including isolated), UnitTestEx was created. This is our attempt to fill this gap and semi-standardize testing implementation - this leverages the WebApplicationFactory
for Web APIs and enables a similar capability for Azure Functions including mocking of services etc.
Implement a test worker and test helpers for public consumption.
This should also be adopted by the worker tests in the project.