Example #1
0
        public async Task RunInFailureShouldLogError()
        {
            // ARRANGE
            await InitializeFakeDaemon().ConfigureAwait(false);

            // ACT
            DefaultDaemonRxApp.RunIn(TimeSpan.FromMilliseconds(100), () => throw new Exception("RxError"));

            // ASSERT
            await Task.Delay(150).ConfigureAwait(false);

            await RunFakeDaemonUntilTimeout().ConfigureAwait(false);

            LoggerMock.AssertLogged(LogLevel.Error, Times.Once());
        }
Example #2
0
        public async Task RunInShouldCallFunction()
        {
            // ARRANGE
            var called = false;

            await InitializeFakeDaemon().ConfigureAwait(false);

            // ACT
            DefaultDaemonRxApp.RunIn(TimeSpan.FromMilliseconds(100), () => called = true);

            // ASSERT
            Assert.False(called);

            await Task.Delay(150).ConfigureAwait(false);

            await RunFakeDaemonUntilTimeout().ConfigureAwait(false);

            Assert.True(called);
        }