How mattherman/mbdotnet works
Main Components
a. Core Components:
• MountebankClient (Main entry point)
• Request Proxy Layer
• Model Layer
• HTTP Client Wrapper
b. Key Abstractions:
• Imposters (HTTP, HTTPS, SMTP, TCP)
• Stubs
• Predicates
• Responses
┌─ Application Layer ─────────────────────────────────────┐
• ┌─ Client Interface ─┐ ┌─ Request Proxy ─┐ │
• IClient │──→ │ IRequestProxy │ │
• MountebankClient│ │ MountebankProxy │ │
• ┘ └────────────────┘ │
• ↓ ↓ │
• ┌─ HTTP Client Wrapper ────────┘ │
• IHttpClientWrapper │
• HttpClientWrapper │
• Domain Model Layer ──────────────────────────────────┤
• ┌─ Imposters ─┐ ┌─ Stubs ─┐ ┌─ Predicates ─┐ │
• HTTP │ │ HttpStub │ │ Contains │ │
• HTTPS │←──│ TcpStub │←──│ Equals │ │
• SMTP │ └─────────┘ │ Matches │ │
• TCP │ └────────────┘ │
• ┘ │
• ┌─ Responses ────┐ ┌─ Request Models ┐ │
• IsResponse │ │ HttpRequest │ │
• FaultResponse │ │ SmtpRequest │ │
• ProxyResponse │ │ TcpRequest │ │
• ┘ └───────────────┘ │
• ┘
Important Relationships to Highlight
• MountebankClient implements IClient
• MountebankClient uses IRequestProxy
• All Imposters inherit from base Imposter class
• Stubs contain Predicates and Responses
• Request Models are used by Predicates
Implementation Details to Note
• The library targets .NET Standard 1.3
• Supports multiple imposter types
• Uses fluent interface pattern for configuration
• Handles serialization/deserialization of requests/responses
Notes for Implementation
• Version information
• Unsupported features (inject response, certain behaviors)