Esempio n. 1
0
        public async Task CreateObservableTimerFailureShouldLogError()
        {
            // ARRANGE
            await using var app = new BaseTestRxApp();
            await app.StartUpAsync(DefaultDaemonHost).ConfigureAwait(false);

            app.IsEnabled = true;

            // ACT
            using var disposable = app.CreateObservableTimer(DateTime.Now, TimeSpan.FromMilliseconds(10), () => throw new Exception("Hello!"));

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

            // ASSERT
            LoggerMock.AssertLogged(LogLevel.Error, Times.AtLeastOnce());
        }
Esempio n. 2
0
        public async Task CreateObservableTimerShouldCallFunction()
        {
            // ARRANGE
            var app = new BaseTestRxApp();

            app.IsEnabled = true;

            var called = false;

            // ACT
            using var disposable = app.CreateObservableTimer(DateTime.Now, TimeSpan.FromMilliseconds(10), () => called = true);

            await Task.Delay(100);

            // ASSERT
            Assert.True(called);
        }