public async Task Display_TraceEvent_On_New_Client()
        {
            XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.CollectClassInfos(GetType().Assembly);
            using (var application = Platform.Win.NewApplication <ReactiveLoggerHubModule>()){
                var startServer = application.WhenTraceOnNextEvent(nameof(ReactiveLoggerHubService.StartServer))
                                  .FirstAsync().SubscribeReplay().SubscribeOn(Scheduler.Default);
                var connecting = TraceEventHub.Connecting.FirstAsync().SubscribeReplay();
                application.AddModule <RXLoggerHubTestsModule>(nameof(Display_TraceEvent_On_New_Client), typeof(RLH));
                application.Logon();
                application.CreateObjectSpace();

                await startServer.Timeout(Timeout);

                using (var clientWinApp = new ClientWinApp()){
                    clientWinApp.EditorFactory = new EditorsFactory();
                    clientWinApp.AddModule <ReactiveLoggerHubModule>();
                    clientWinApp.Logon();


                    var listView           = clientWinApp.CreateObjectView <ListView>(typeof(TraceEvent));
                    var collectionReloaded = listView.CollectionSource.WhenCollectionReloaded().FirstAsync().SubscribeReplay();
                    clientWinApp.CreateViewWindow().SetView(listView);

                    await connecting.Timeout(Timeout);

                    var receive   = TraceEventReceiver.TraceEvent.FirstAsync(_ => _.Method == nameof(XafApplicationRXExtensions.WhenDetailViewCreated)).SubscribeReplay();
                    var broadcast = TraceEventHub.Broadcasted.FirstAsync(_ => _.Method == nameof(XafApplicationRXExtensions.WhenDetailViewCreated))
                                    .SubscribeReplay();
                    var detailViewCreated = application.WhenDetailViewCreated().FirstAsync().SubscribeReplay();



                    application.CreateObjectView <DetailView>(typeof(RLH));


                    await broadcast.Timeout(Timeout);

                    await receive.Timeout(Timeout);

                    await detailViewCreated.Timeout(Timeout);

                    await collectionReloaded;
                    var   events = listView.CollectionSource.Objects <TraceEvent>().ToArray();
                    events.FirstOrDefault(_ => _.Method == nameof(XafApplicationRXExtensions.WhenDetailViewCreated)).ShouldNotBeNull();
                    events.FirstOrDefault(_ => _.Location == nameof(ReactiveLoggerHubService)).ShouldNotBeNull();
                }
            }
        }
Ejemplo n.º 2
0
        public async Task Display_TraceEvent_On_Running_Client()
        {
            using (var clientWinApp = new ClientWinApp()){
                clientWinApp.EditorFactory = new EditorsFactory();
                clientWinApp.AddModule <ReactiveLoggerHubModule>();
                clientWinApp.Logon();
                var listView   = clientWinApp.CreateObjectView <ListView>(typeof(TraceEvent));
                var viewWindow = clientWinApp.CreateWindow(TemplateContext.ApplicationWindow, new List <Controller>(), true);
                viewWindow.SetView(listView);

                using (var application = Platform.Win.NewApplication <ReactiveLoggerHubModule>()){
                    var startServer = application.WhenTraceOnNextEvent(nameof(ReactiveLoggerHubService.StartServer))
                                      .FirstAsync().SubscribeReplay();
                    var connecting = TraceEventHub.Connecting.FirstAsync().SubscribeReplay();

                    application.AddModule <RXLoggerHubTestsModule>(nameof(Display_TraceEvent_On_Running_Client), typeof(RLH));
                    application.Logon();
                    application.CreateObjectSpace();

                    await startServer.Timeout(Timeout);

                    await connecting.Timeout(Timeout);

                    var viewCreated = clientWinApp.WhenTraceOnNextEvent(nameof(XafApplicationRXExtensions.WhenDetailViewCreated))
                                      .FirstAsync().SubscribeReplay();
                    var whenDetailViewCreated = application.WhenDetailViewCreated().FirstAsync().SubscribeReplay();
                    application.CreateObjectView <DetailView>(typeof(RLH));
                    await viewCreated.Timeout(Timeout).ToTaskWithoutConfigureAwait();

                    await listView.CollectionSource.WhenCollectionReloaded().FirstAsync();

                    await whenDetailViewCreated;
                    var   events = listView.CollectionSource.Objects <TraceEvent>().ToArray();
                    events.FirstOrDefault(_ => _.Method == nameof(XafApplicationRXExtensions.WhenDetailViewCreated)).ShouldNotBeNull();
                    events.FirstOrDefault(_ => _.Location == nameof(ReactiveLoggerHubService)).ShouldNotBeNull();
                }
            }
        }