Beispiel #1
0
            public async void ServiceProviderShouldReturnCorrectService()
            {
                // ARRANGE
                DefaultServiceCollection.AddSingleton <ITestGetService>(new TestGetService());

                await using var app = new BaseTestRxApp { Id = " _rx_id" };
                app.ConfigureAwait(false);
                DefaultDaemonHost.AddRunningApp(app);

                // ACT
                var service = app.ServiceProvider?.GetService(typeof(ITestGetService)) as TestGetService;

                // ASSERT
                Assert.NotNull(service);
                Assert.Equal("Test", service?.TestString);
            }
Beispiel #2
0
        public async Task CreateObservableIntervallFailureShouldLogError()
        {
            // ARRANGE
            await using var app = new BaseTestRxApp();
            app.ConfigureAwait(false);
            await app.StartUpAsync(DefaultDaemonHost).ConfigureAwait(false);

            app.IsEnabled = true;

            // ACT
            using var disposable = app.CreateObservableIntervall(TimeSpan.FromMilliseconds(10), () => throw new Exception("hello!"));

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

            // ASSERT
            LoggerMock.AssertLogged(LogLevel.Error, Times.AtLeastOnce());
        }