Ejemplo n.º 1
0
        public void Setup()
        {
            // Initialize event counters
            _increaseTempEventsReceived = 0;
            _decreaseTempEventsreceived = 0;

            _tempSource = Substitute.For <ITempSource>();
            _uut        = new Control(_tempSource, 25); // Control should hook up to event source

            // Initialize anonymous event listeners that listen to events from Control
            // See e.g. http://nsubstitute.github.io/help/raising-events/
            _uut.IncreaseTempEvent += (sender, args) => { ++_increaseTempEventsReceived; };
            _uut.DecreaseTempEvent += (sender, args) => { ++_decreaseTempEventsreceived; };
        }
Ejemplo n.º 2
0
 public Control(ITempSource tempSource, int threshold)
 {
     tempSource.TempChangedEvent += HandleTempChangedEvent;
     Threshold = threshold;
 }