AusweisApp2/test/helper/MockRemoteDispatcher.h

55 lines
1.0 KiB
C
Raw Normal View History

2017-12-20 14:54:05 +01:00
/*!
* \brief Remote dispatcher mock for tests.
*
2019-05-22 10:08:38 +02:00
* \copyright Copyright (c) 2017-2019 Governikus GmbH & Co. KG, Germany
2017-12-20 14:54:05 +01:00
*/
#pragma once
2019-01-03 15:06:22 +01:00
#include "RemoteDispatcherClient.h"
2017-12-20 14:54:05 +01:00
namespace governikus
{
class MockRemoteDispatcher
2019-01-03 15:06:22 +01:00
: public RemoteDispatcherClient
2017-12-20 14:54:05 +01:00
{
Q_OBJECT
public:
enum class DispatcherState
{
WithoutReader,
ReaderWithoutCard,
ReaderWithCard,
ReaderWithCardError
};
private:
DispatcherState mState;
QString mId;
QString mContextHandle;
public:
MockRemoteDispatcher(DispatcherState pState = DispatcherState::WithoutReader);
2019-01-03 15:06:22 +01:00
virtual QString getId() const override;
2017-12-20 14:54:05 +01:00
virtual const QString& getContextHandle() const override;
2019-01-03 15:06:22 +01:00
Q_INVOKABLE virtual void send(const QSharedPointer<const RemoteMessage>& pMessage) override;
2017-12-20 14:54:05 +01:00
DispatcherState getState() const;
void setState(DispatcherState pState);
void onClosed();
public Q_SLOTS:
void onReceived(const QSharedPointer<const RemoteMessage>& pMessage);
Q_SIGNALS:
void fireSend(const QSharedPointer<const RemoteMessage>& pMessage);
};
2019-01-03 15:06:22 +01:00
} // namespace governikus