public async Task <PID> BuildAndRun(int numberOfComponents = 1)
        {
            var bootstrapper = new MockBootstrapper(_container, _configuration);

            _controller = await bootstrapper.BuildController();

            _broker = _container.GetInstance <IMessageBroker>();

            await WaitToStart(numberOfComponents);

            return(_controller);
        }
Example #2
0
        public async Task <(IMessageBroker broker, LogMock logs, ITestAdapter adapter)> BuildAndRun()
        {
            var bootstrapper = new MockBootstrapper(_container, _configuration);

            _controller = await bootstrapper.BuildController().ConfigureAwait(false);

            //var tcs = TaskHelper.GenerateTimeoutTaskSource<bool>(500);
            var tcs = new TaskCompletionSource <bool>();

            _broker = _container.GetInstance <IMessageBroker>();
            _broker.SubscribeForEvent <SystemStartedEvent>(_ => tcs.SetResult(true));
            await tcs.Task;

            var adapter = await _broker.Request <GetAdapterQuery, ITestAdapter>(new GetAdapterQuery(), _adapter).ConfigureAwait(false);

            return(_broker, bootstrapper.Logs, adapter);
        }