public async Task RemoveBroker() { var sessionProvider = new RSessionProvider(_services); var session1 = sessionProvider.GetOrCreate(nameof(RemoveBroker) + 1); var session2 = sessionProvider.GetOrCreate(nameof(RemoveBroker) + 2); session2.RestartOnBrokerSwitch = true; await sessionProvider.TrySwitchBrokerAsync(nameof(RSessionProviderTest) + nameof(RemoveBroker)).Should().BeCompletedAsync(); session1.HostStarted.Should().NotBeCompleted(); session2.HostStarted.Should().BeCompleted(); await session1.EnsureHostStartedAsync(new RHostStartupInfo(), null, 5000).Should().BeCompletedAsync(); await sessionProvider.RemoveBrokerAsync(); session1.IsHostRunning.Should().BeFalse(); session2.IsHostRunning.Should().BeFalse(); }