PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::di::test::TestContainerBuilder Class Reference

#include <test_support.h>

Collaboration diagram for kcenon::pacs::di::test::TestContainerBuilder:
Collaboration graph

Public Member Functions

 TestContainerBuilder ()=default
 
TestContainerBuilderwith_storage (std::shared_ptr< MockStorage > storage)
 Use a specific mock storage instance.
 
TestContainerBuilderwith_mock_storage ()
 Create and use a new mock storage.
 
TestContainerBuilderwith_network (std::shared_ptr< MockNetwork > network)
 Use a specific mock network instance.
 
TestContainerBuilderwith_mock_network ()
 Create and use a new mock network.
 
std::shared_ptr< kcenon::common::di::service_container > build ()
 Build the configured container.
 
std::shared_ptr< MockStoragestorage () const
 Get the mock storage instance (for test assertions)
 
std::shared_ptr< MockNetworknetwork () const
 Get the mock network instance (for test assertions)
 

Private Attributes

std::shared_ptr< MockStoragemock_storage_
 
std::shared_ptr< MockNetworkmock_network_
 

Detailed Description

Definition at line 281 of file test_support.h.

Constructor & Destructor Documentation

◆ TestContainerBuilder()

kcenon::pacs::di::test::TestContainerBuilder::TestContainerBuilder ( )
default

Member Function Documentation

◆ build()

std::shared_ptr< kcenon::common::di::service_container > kcenon::pacs::di::test::TestContainerBuilder::build ( )
inlinenodiscard

Build the configured container.

Returns
Shared pointer to configured service container
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 322 of file test_support.h.

322 {
323 auto container = std::make_shared<kcenon::common::di::service_container>();
324
325 if (mock_storage_) {
326 container->register_instance<IDicomStorage>(mock_storage_);
327 }
328
329 if (mock_network_) {
330 container->register_instance<IDicomNetwork>(mock_network_);
331 }
332
333 return container;
334 }
std::shared_ptr< MockNetwork > mock_network_
std::shared_ptr< MockStorage > mock_storage_
@ container
CONTAINER - Container for other items.

References mock_network_, and mock_storage_.

Referenced by kcenon::pacs::di::test::create_test_container().

Here is the caller graph for this function:

◆ network()

std::shared_ptr< MockNetwork > kcenon::pacs::di::test::TestContainerBuilder::network ( ) const
inlinenodiscard

Get the mock network instance (for test assertions)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 346 of file test_support.h.

346 {
347 return mock_network_;
348 }

References mock_network_.

Referenced by with_network().

Here is the caller graph for this function:

◆ storage()

std::shared_ptr< MockStorage > kcenon::pacs::di::test::TestContainerBuilder::storage ( ) const
inlinenodiscard

Get the mock storage instance (for test assertions)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 339 of file test_support.h.

339 {
340 return mock_storage_;
341 }

References mock_storage_.

Referenced by with_storage().

Here is the caller graph for this function:

◆ with_mock_network()

TestContainerBuilder & kcenon::pacs::di::test::TestContainerBuilder::with_mock_network ( )
inline

Create and use a new mock network.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 312 of file test_support.h.

312 {
313 mock_network_ = std::make_shared<MockNetwork>();
314 return *this;
315 }

References mock_network_.

Referenced by kcenon::pacs::di::test::create_test_container().

Here is the caller graph for this function:

◆ with_mock_storage()

TestContainerBuilder & kcenon::pacs::di::test::TestContainerBuilder::with_mock_storage ( )
inline

Create and use a new mock storage.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 296 of file test_support.h.

296 {
297 mock_storage_ = std::make_shared<MockStorage>();
298 return *this;
299 }

References mock_storage_.

Referenced by kcenon::pacs::di::test::create_test_container().

Here is the caller graph for this function:

◆ with_network()

TestContainerBuilder & kcenon::pacs::di::test::TestContainerBuilder::with_network ( std::shared_ptr< MockNetwork > network)
inline

Use a specific mock network instance.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 304 of file test_support.h.

304 {
305 mock_network_ = std::move(network);
306 return *this;
307 }
std::shared_ptr< MockNetwork > network() const
Get the mock network instance (for test assertions)

References mock_network_, and network().

Here is the call graph for this function:

◆ with_storage()

TestContainerBuilder & kcenon::pacs::di::test::TestContainerBuilder::with_storage ( std::shared_ptr< MockStorage > storage)
inline

Use a specific mock storage instance.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/di/test_support.h.

Definition at line 288 of file test_support.h.

288 {
289 mock_storage_ = std::move(storage);
290 return *this;
291 }
std::shared_ptr< MockStorage > storage() const
Get the mock storage instance (for test assertions)

References mock_storage_, and storage().

Here is the call graph for this function:

Member Data Documentation

◆ mock_network_

std::shared_ptr<MockNetwork> kcenon::pacs::di::test::TestContainerBuilder::mock_network_
private

◆ mock_storage_

std::shared_ptr<MockStorage> kcenon::pacs::di::test::TestContainerBuilder::mock_storage_
private

The documentation for this class was generated from the following file: