예제 #1
0
        static void Main(string[] args)
        {
            InMemoryTemperatureReader myTemperatureReader = new InMemoryTemperatureReader();
            ThermoMeter  myThermoMeter  = new ThermoMeter(myTemperatureReader);
            Oven         myOven         = new Oven(myThermoMeter);
            Refrigerator myRefrigerator = new Refrigerator(myThermoMeter);

            OvenRegistrationInfo myOvenRegistrationInfo = new OvenRegistrationInfo(0, 0.5, Direction.Positive);

            myOven.RegisrterForTemperatureChange(myOvenRegistrationInfo);

            RefrigeratorRegistrationInfo myRefrigeratorRegistrationInfo = new RefrigeratorRegistrationInfo(0, 0.5, Direction.None);

            myRefrigerator.RegisrterForTemperatureChange(myRefrigeratorRegistrationInfo);

            for (int i = 0; i < 15; i++)
            {
                myTemperatureReader.Next();
            }

            Console.ReadLine();
        }
예제 #2
0
 public Oven(ThermoMeter thermoMeter)
 {
     _thermoMeter = thermoMeter;
 }
예제 #3
0
 public Refrigerator(ThermoMeter thermoMeter)
 {
     _thermoMeter = thermoMeter;
 }