Documentation
¶
Index ¶
- func NewAirMonitor[V data.ValueType](tb testing.TB, opts ...MockAirMonitorOption) air.AirMonitor
- func NewColour(tb testing.TB, opts ...MockColouredOption) light.Colour
- func NewDimmer(tb testing.TB, opts ...MockDimmerOption) light.Dimmer
- func NewFan(tb testing.TB, opts ...MockFanOption) air.Fan
- func NewHeater[V data.ValueType](tb testing.TB, opts ...MockHeaterOption[V]) air.Heater[V]
- func NewLight(tb testing.TB, opts ...MockLightOption) light.Light
- func NewMonitor(tb testing.TB, opts ...MockMonitorOption) outlet.Monitor
- func NewOutlet(tb testing.TB, opts ...MockOutletOption) outlet.Outlet
- type MethodCallOption
- type MockAirMonitor
- type MockAirMonitorOption
- type MockColour
- type MockColouredOption
- type MockDevice
- type MockDeviceOption
- func WithAsserDeviceGetInformation(ctx context.Context, info *device.Information, err error, ...) MockDeviceOption
- func WithAssertDeviceHeartbeat(ctx context.Context, state device.State, err error, opts ...MethodCallOption) MockDeviceOption
- func WithAssertDevicePower(ctx context.Context, on bool, err error, opts ...MethodCallOption) MockDeviceOption
- type MockDimmer
- type MockDimmerOption
- type MockFan
- type MockFanOption
- type MockHeater
- type MockHeaterOption
- type MockLight
- type MockLightOption
- type MockMonitor
- type MockMonitorOption
- type MockMonitoredDevice
- type MockMonitoredDeviceOption
- type MockOutlet
- type MockOutletOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAirMonitor ¶
func NewAirMonitor[V data.ValueType](tb testing.TB, opts ...MockAirMonitorOption) air.AirMonitor
func NewMonitor ¶
func NewMonitor(tb testing.TB, opts ...MockMonitorOption) outlet.Monitor
Types ¶
type MethodCallOption ¶
MethodCallOption allows to extend the assertion of the method
func WithMethodPanic ¶
func WithMethodPanic(message string) MethodCallOption
func WithMethodTimes ¶
func WithMethodTimes(count int) MethodCallOption
func WithMethodVirtualWait ¶
func WithMethodVirtualWait(clk clock.Clock, d time.Duration) MethodCallOption
type MockAirMonitor ¶
type MockAirMonitor struct { air.EmbedableAirMonitor MockMonitoredDevice }
type MockAirMonitorOption ¶
type MockAirMonitorOption func(mam *MockAirMonitor)
type MockColour ¶
type MockColour struct {
MockLight
}
type MockColouredOption ¶
type MockColouredOption func(mc *MockColour)
func WithColourAssertSetColour ¶
func WithColourAssertSetColour(ctx context.Context, c color.Color, err error, opts ...MethodCallOption) MockColouredOption
func WithColourDeviceOptions ¶
func WithColourDeviceOptions(opts ...MockDeviceOption) MockColouredOption
type MockDevice ¶
MockDevice implements all the methods that a potential device can be. Using this mock, you must use the highest order value otherwise, you could potentially cast to the wrong type
func NewDevice ¶
func NewDevice(tb testing.TB, opts ...MockDeviceOption) *MockDevice
func (*MockDevice) GetInformation ¶
func (md *MockDevice) GetInformation(ctx context.Context) (*device.Information, error)
type MockDeviceOption ¶
type MockDeviceOption func(md *MockDevice)
func WithAsserDeviceGetInformation ¶
func WithAsserDeviceGetInformation(ctx context.Context, info *device.Information, err error, opts ...MethodCallOption) MockDeviceOption
func WithAssertDeviceHeartbeat ¶
func WithAssertDeviceHeartbeat(ctx context.Context, state device.State, err error, opts ...MethodCallOption) MockDeviceOption
func WithAssertDevicePower ¶
func WithAssertDevicePower(ctx context.Context, on bool, err error, opts ...MethodCallOption) MockDeviceOption
type MockDimmer ¶
type MockDimmer struct {
MockLight
}
func (*MockDimmer) SetBrightness ¶
func (md *MockDimmer) SetBrightness(ctx context.Context, percentage float64) error
type MockDimmerOption ¶
type MockDimmerOption func(md *MockDimmer)
func WithDimmerDeviceOptions ¶
func WithDimmerDeviceOptions(opts ...MockDeviceOption) MockDimmerOption
func WithLightAssertSetBrightness ¶
func WithLightAssertSetBrightness(ctx context.Context, percentage float64, err error, opts ...MethodCallOption) MockDimmerOption
type MockFan ¶
type MockFan struct {
MockDevice
}
type MockFanOption ¶
type MockFanOption func(mf *MockFan)
func WithAssertFanSetSpeed ¶
func WithAssertFanSetSpeed(ctx context.Context, speed float64, err error, opts ...MethodCallOption) MockFanOption
func WithFanDeviceOptions ¶
func WithFanDeviceOptions(opts ...MockDeviceOption) MockFanOption
type MockHeater ¶
func (*MockHeater[V]) SetTemperature ¶
type MockHeaterOption ¶
type MockHeaterOption[V data.ValueType] func(mh *MockHeater[V])
func WithHeaterFanOptions ¶
func WithHeaterFanOptions[V data.ValueType](opts ...MockFanOption) MockHeaterOption[V]
type MockLight ¶
type MockLight struct { MockDevice light.EmbedableLight }
type MockLightOption ¶
type MockLightOption func(ml *MockLight)
func WithLightDeviceOptions ¶
func WithLightDeviceOptions(opts ...MockLightOption) MockLightOption
type MockMonitor ¶
type MockMonitor struct { MockMonitoredDevice outlet.EmbedableMonitor }
type MockMonitorOption ¶
type MockMonitorOption func(mo *MockMonitor)
func WithMonitorDeviceOptions ¶
func WithMonitorDeviceOptions(opts ...MockMonitoredDeviceOption) MockMonitorOption
type MockMonitoredDevice ¶
type MockMonitoredDevice struct {
MockDevice
}
MockMonitoredDevice embeds the MockDevice an implements the method GetStatistics Please refere to MockDevice's warning
func NewMonitoredDevice ¶
func NewMonitoredDevice(tb testing.TB, opts ...MockMonitoredDeviceOption) *MockMonitoredDevice
func (*MockMonitoredDevice) GetStatistics ¶
type MockMonitoredDeviceOption ¶
type MockMonitoredDeviceOption func(md *MockMonitoredDevice)
func WithAssertMonitoredDeviceGetStatstics ¶
func WithAssertMonitoredDeviceGetStatstics(ctx context.Context, stats []data.Statistic, err error, opts ...MethodCallOption) MockMonitoredDeviceOption
func WithMonitoredDeviceOptions ¶
func WithMonitoredDeviceOptions(opts ...MockDeviceOption) MockMonitoredDeviceOption
type MockOutlet ¶
type MockOutlet struct { MockDevice outlet.EmbedableOutlet }
type MockOutletOption ¶
type MockOutletOption func(mo *MockOutlet)
func WithOutletDeviceOptions ¶
func WithOutletDeviceOptions(opts ...MockDeviceOption) MockOutletOption
Click to show internal directories.
Click to hide internal directories.