Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 8.68 KB

File metadata and controls

63 lines (51 loc) · 8.68 KB
Clean Architecture Toolkit for .NET
Clean Architecture Toolkit is a clean, modular architecture foundation for .NET applications.
It embraces SOLID principles and focuses on maintainability, testability, and scalability through clear boundaries and pluggable design.

|   HOME   |   REPO OVERVIEW   |   DEMO   |   CAT.UNITTESTING   |

Code Reference

FakeServiceRequestProcessor Class

A service request processor for unit tests. It records every service request and returns what the test says. It works like the fake command processor: a request without a result gets DefaultResponse, and a request with a result needs a set up response.

public class FakeServiceRequestProcessor : Cat.ServiceRequests.Abstractions.ICatServiceRequestProcessor

Inheritance System.Object → FakeServiceRequestProcessor

Implements ICatServiceRequestProcessor

Fields
_responses
Properties
DefaultResponse The response of a service request without a result when the test set up nothing for its type. It starts as Ok().
Requests Every service request that was processed, in order. It holds requests with and without a result.
Methods
Of<T>() Gives the processed service requests of one type, in order.
Process(ICatServiceRequest) Runs a service request that returns no payload and blocks until it finishes. Prefer ProcessAsync(ICatServiceRequest, CancellationToken) when you can.
Process<TResponse>(ICatServiceRequest<TResponse>) Runs a service request that returns a payload and blocks until it finishes. Prefer ProcessAsync<TResponse>(ICatServiceRequest<TResponse>, CancellationToken) when you can.
ProcessAsync(ICatServiceRequest, CancellationToken) Runs a service request that returns no payload.
ProcessAsync<TResponse>(ICatServiceRequest<TResponse>, CancellationToken) Runs a service request that returns a payload.
Reset() Clears the recorded requests, the set up responses and the default response.
Respond<TRequest,TResponse>(ICatResponse<TResponse>) Sets the response for a service request with a result.
Respond<TRequest,TResponse>(Func<TRequest,ICatResponse<TResponse>>) Sets the response for a service request with a result, built from the request.
Respond<TRequest>(ICatResponse) Sets the response for a service request without a result.
Respond<TRequest>(Func<TRequest,ICatResponse>) Sets the response for a service request without a result, built from the request.