Beispiel #1
0
        public void SetUp()
        {
            _mockTimer          = new Mock <ITimer>();
            _mockStatusProvider = new Mock <IStatusProvider>();
            _mockWebService     = new Mock <INestWebService>();

            ServiceContainer.RegisterService <ITimer>(_mockTimer.Object);
            ServiceContainer.RegisterService <INestWebService>(_mockWebService.Object);
            ServiceContainer.RegisterService <IStatusProvider>(_mockStatusProvider.Object);

            _mockWebService.Setup(w => w.GetThermostatStatusAsync(It.IsAny <Thermostat>())).Returns(Task.FromResult(new GetThermostatStatusResult(new Thermostat(""))));
            _mockWebService.Setup(w => w.GetStructureAndDeviceStatusAsync(It.IsAny <Structure>())).Returns(Task.FromResult(new GetStatusResult(new[] { new Structure("") })));
            _mockTimer.Setup(t => t.SetCallback(It.IsAny <TimerCallback>())).Callback <TimerCallback>(c => _timerCallback = c);
            _mockStatusProvider.Setup(s => s.CacheStatus(It.IsAny <GetStatusResult>())).Callback <GetStatusResult>(g => _cachedStatusResult = g);

            _updaterService = new StatusUpdaterService();
        }
Beispiel #2
0
 public void SetUp()
 {
     _statusUpdaterService = new StatusUpdaterService();
     _mockWebSerivce       = new Mock <INestWebService>();
 }