public void OnDeskDetected_ForInvoked_CallsDeskDetectorStop( DeskProvider sut, [Freeze] IDeskDetector detector, IDesk desk) { sut.OnDeskDetected(desk); detector.Received( ) .Stop( ); }
public void StopDetecting_ForInvoked_CallsDeskDetectorStart( DeskProvider sut, [Freeze] IDeskDetector detector, string deviceName, ulong deviceAddress, uint deviceTimeout) { sut.Initialize(deviceName, deviceAddress, deviceTimeout) .StopDetecting( ); detector.Received( ) .Stop( ); }
public async Task TryGetDesk_ForInvoked_CallsDeskDetectorStart( DeskProvider sut, [Freeze] IDeskDetector detector, CancellationTokenSource source, string deviceName, ulong deviceAddress, uint deviceTimeout) { await sut.Initialize(deviceName, deviceAddress, deviceTimeout) .TryGetDesk(source.Token); detector.Received( ) .Start( ); }
public async Task TryGetDesk_ForCancelled_ReturnsNullForDesk( DeskProvider sut, [Freeze] IDeskDetector detector, CancellationTokenSource source, string deviceName, ulong deviceAddress, uint deviceTimeout) { detector.When(x => x.Initialize(deviceName, deviceAddress, deviceTimeout)) .Do(info => { source.Cancel( ); }); var(_, desk) = await sut.Initialize(deviceName, deviceAddress, deviceTimeout) .TryGetDesk(source.Token); desk.Should( ) .BeNull( ); }
public DeskProvider( [NotNull] ILogger logger, [NotNull] ITaskRunner taskRunner, [NotNull] IScheduler scheduler, [NotNull] IDeskDetector detector, [NotNull] IErrorManager errorManager) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(taskRunner, nameof(taskRunner)); Guard.ArgumentNotNull(scheduler, nameof(scheduler)); Guard.ArgumentNotNull(detector, nameof(detector)); Guard.ArgumentNotNull(errorManager, nameof(errorManager)); _logger = logger; _taskRunner = taskRunner; _scheduler = scheduler; _detector = detector; _errorManager = errorManager; }