DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::networking::testing::RequestSenderMock Struct Referencefinal

A mock implementation of the networking::RequestSender interface for testing purposes. It is designed to support unit testing of components that rely on sending network requests by mocking the functionality of the RequestSender interface. It eliminates the need for actual network communication during tests, enabling controlled and reproducible test environments. More...

#include <RequestSender.hpp>

Inheritance diagram for drn::networking::testing::RequestSenderMock:
Collaboration diagram for drn::networking::testing::RequestSenderMock:

Public Member Functions

 QMOCK (foundation::UniqueQtPtr< ReplyResponse >, get,(const ::QNetworkRequest &),())
 
 RequestSender (const foundation::QtPtr< QObject > &parent)
 Fully initialises the object with a specified parent.
 
- Public Member Functions inherited from drn::networking::RequestSender
 RequestSender (const foundation::QtPtr< QObject > &parent)
 Fully initialises the object with a specified parent.
 
virtual foundation::UniqueQtPtr< ReplyResponseget (const QNetworkRequest &request)=0
 When implemented, sends a GET request to the specified network address.
 

Detailed Description

A mock implementation of the networking::RequestSender interface for testing purposes. It is designed to support unit testing of components that rely on sending network requests by mocking the functionality of the RequestSender interface. It eliminates the need for actual network communication during tests, enabling controlled and reproducible test environments.

The mock provides a customizable implementation for sending network requests and returning mocked responses, allowing precise control over the behavior and outputs of the request-sending process.

Usage:

  • Use QMOCK to configure the behavior for the methods, which simulates sending a network request and receiving a mocked response represented as a unique pointer to a ReplyResponse object.
  • Inject this mock into the components or systems under test that depend on the RequestSender.

Key Features:

  • Provides mock functionality for the get method, enabling simulation of network interactions.
  • Ensures isolation of tests from external factors like network conditions or real endpoints.
  • Simplifies validation of scenarios involving request-sending logic.

Member Function Documentation

◆ QMOCK()

drn::networking::testing::RequestSenderMock::QMOCK ( foundation::UniqueQtPtr< ReplyResponse > ,
get ,
(const ::QNetworkRequest &) ,
()  )
Here is the call graph for this function:

◆ RequestSender()

drn::networking::RequestSender::RequestSender ( const foundation::QtPtr< QObject > & parent)
explicit

Fully initialises the object with a specified parent.

Parameters
parentThe parent used to manage the memory and lifecycle of this instance, and ensuring it follows the Qt object hierarchy.