Beispiel #1
0
        public void Update_WhenLastTimeIsLessThanTimeToIdle_StatusIsBusy(IUserIdleMonitorConfiguration configuration)
        {
            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var returnThis   = DateTime.Now - (configuration.TimeToIdle - TimeSpan.FromMinutes(1));
            var inputManager = Substitute.For <IInputManager>();

            inputManager.GetLastInputTime()
            .Returns(returnThis);

            var sut = new UserIdleMonitor(configuration, inputManager);

            var actual = sut.GetStatus();

            Assert.Equal(InteractionStatus.Busy, actual);
        }
Beispiel #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="UserIdleMonitor"/> class.
 /// </summary>
 /// <param name="configuration">
 ///     The configuration for the monitor.
 /// </param>
 /// <param name="inputManager">
 ///     Allows to check the last time the user has used an input device.
 /// </param>
 public UserIdleMonitor(IUserIdleMonitorConfiguration configuration, IInputManager inputManager)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _inputManager  = inputManager ?? throw new ArgumentNullException(nameof(inputManager));
 }