Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/sensor.hpp" |
| 4 | #include "utils/generate_unique_mock_id.hpp" |
| 5 | |
| 6 | #include <gmock/gmock.h> |
| 7 | |
| 8 | class SensorMock : public interfaces::Sensor |
| 9 | { |
| 10 | public: |
| 11 | explicit SensorMock(Id sensorId) : mockSensorId(sensorId) |
| 12 | { |
| 13 | ON_CALL(*this, id()).WillByDefault(testing::Invoke([this] { |
| 14 | return this->mockSensorId; |
| 15 | })); |
| 16 | } |
| 17 | |
| 18 | static Id makeId(std::string_view service, std::string_view path) |
| 19 | { |
| 20 | return Id("SensorMock", service, path); |
| 21 | } |
| 22 | |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 23 | MOCK_METHOD(Id, id, (), (const, override)); |
| 24 | MOCK_METHOD(void, registerForUpdates, |
| 25 | (const std::weak_ptr<interfaces::SensorListener>&), (override)); |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 26 | |
| 27 | const uint64_t mockId = generateUniqueMockId(); |
| 28 | |
| 29 | Id mockSensorId = Id("SensorMock", "", ""); |
| 30 | }; |