Documentation
¶
Index ¶
- type FakeThermostatService
- func (f *FakeThermostatService) Get() thermostat.Snapshot
- func (f *FakeThermostatService) SetEnabled(b bool)
- func (f *FakeThermostatService) SetFanSpeed(fs thermostat.FanSpeed) error
- func (f *FakeThermostatService) SetFaultCode(code int)
- func (f *FakeThermostatService) SetMinMax(min, max float64) error
- func (f *FakeThermostatService) SetMode(m thermostat.Mode) error
- func (f *FakeThermostatService) SetSetpoint(v float64) error
- type FakeWeatherProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeThermostatService ¶
type FakeThermostatService struct {
S thermostat.Snapshot
SetEnabledCalled bool
SetEnabledArg bool
SetSetpointCalled bool
SetSetpointArg float64
SetSetpointErr error
SetMinMaxCalled bool
SetMinMaxMin float64
SetMinMaxMax float64
SetMinMaxErr error
SetModeCalled bool
SetModeArg thermostat.Mode
SetModeErr error
SetFanSpeedCalled bool
SetFanSpeedArg thermostat.FanSpeed
SetFanSpeedErr error
SetFaultCodeCalled bool
SetFaultCodeArg int
}
FakeThermostatService is a reusable fake implementing thermostat.Service. Put ONLY what multiple test packages need here.
func NewFakeThermostatService ¶
func NewFakeThermostatService() *FakeThermostatService
func (*FakeThermostatService) Get ¶
func (f *FakeThermostatService) Get() thermostat.Snapshot
func (*FakeThermostatService) SetEnabled ¶
func (f *FakeThermostatService) SetEnabled(b bool)
func (*FakeThermostatService) SetFanSpeed ¶
func (f *FakeThermostatService) SetFanSpeed(fs thermostat.FanSpeed) error
func (*FakeThermostatService) SetFaultCode ¶
func (f *FakeThermostatService) SetFaultCode(code int)
func (*FakeThermostatService) SetMinMax ¶
func (f *FakeThermostatService) SetMinMax(min, max float64) error
func (*FakeThermostatService) SetMode ¶
func (f *FakeThermostatService) SetMode(m thermostat.Mode) error
func (*FakeThermostatService) SetSetpoint ¶
func (f *FakeThermostatService) SetSetpoint(v float64) error
type FakeWeatherProvider ¶ added in v0.9.0
type FakeWeatherProvider struct {
Temps []float64
Err error
Calls int
// contains filtered or unexported fields
}
FakeWeatherProvider returns Temps in sequence, repeating the last one once exhausted, or Err when set. Safe for concurrent use.
func NewFakeWeatherProvider ¶ added in v0.9.0
func NewFakeWeatherProvider(temp float64) *FakeWeatherProvider
NewFakeWeatherProvider returns a provider that always reports temp.
func (*FakeWeatherProvider) CallCount ¶ added in v0.9.0
func (f *FakeWeatherProvider) CallCount() int
CallCount reads Calls under the lock, for use while the provider runs concurrently.
func (*FakeWeatherProvider) OutdoorTemperature ¶ added in v0.9.0
func (f *FakeWeatherProvider) OutdoorTemperature(context.Context) (float64, error)
OutdoorTemperature returns the next temperature in the sequence, or Err if set.
Click to show internal directories.
Click to hide internal directories.