Esempio n. 1
0
        public SensorCabinet(IList <ISensor> sensors)
        {
            Debug.Assert(sensors != null, "list of sensors should be initialized at this point");
            _sensors = sensors;

            // initialize loggers with default null-object implementations
            _temperatureSensorLogger = new TemperatureSensorNullObjectLogger();
            _pressureSensorLogger    = new PressureSensorNullObjectLogger();
        }
Esempio n. 2
0
        public SensorCabinet WithTemperatureSensorLogger(TemperatureSensorLogger temperatureSensorLogger = null)
        {
            if (temperatureSensorLogger != null)
            {
                _temperatureSensorLogger = temperatureSensorLogger;
            }

            return(this);
        }
        private static void InitializeSensorLoggers()
        {
            DiagnosticsLogger diagnosticsLogger = new DiagnosticsLogger();

            temperatureSensorLogger = new TemperatureSensorLogger(diagnosticsLogger);
        }