Exemple #1
0
        public async Task Connect_Client()
        {
            using var clientWinApp = new ClientWinApp();
            clientWinApp.AddModule <ReactiveLoggerHubModule>(typeof(RLH), typeof(BaseObject));
            var connectClient = clientWinApp.WhenTraceOnNextEvent(nameof(ReactiveLoggerHubService.ConnectClient)).FirstAsync()
                                .SubscribeOn(Scheduler.Default)
                                .SubscribeReplay();

            clientWinApp.Logon();
            clientWinApp.CreateObjectSpace();


            using (var application = Platform.Win.NewApplication <ReactiveLoggerHubModule>()){
                application.AddModule <ReactiveLoggerHubModule>(nameof(Connect_Client), typeof(RLH), typeof(BaseObject));
                application.Logon();
                application.CreateObjectSpace();
                await connectClient.FirstAsync().Timeout(Timeout);
            }
            connectClient = clientWinApp.WhenTraceOnNextEvent(nameof(ReactiveLoggerHubService.ConnectClient)).FirstAsync()
                            .SubscribeReplay();
            using (var application = Platform.Win.NewApplication <ReactiveLoggerHubModule>()){
                application.AddModule <ReactiveLoggerHubModule>($"{nameof(Connect_Client)}_2", typeof(RLH), typeof(BaseObject));
                application.Logon();
                application.CreateObjectSpace();

                await connectClient.FirstAsync().Timeout(Timeout);

                connectClient.Test().ItemCount.ShouldBe(1);
            }
        }
Exemple #2
0
        public async Task Display_TraceEvent_On_New_Client()
        {
            var dictionary = XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary;

            dictionary.CollectClassInfos(GetType().Assembly);
            dictionary.CollectClassInfos(typeof(ModuleInfo).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 <ReactiveLoggerHubModule>(typeof(RLH));
            application.Model.ToReactiveModule <IModelReactiveModuleLogger>().ReactiveLogger.TraceSources[nameof(ReactiveModule)].Level = SourceLevels.Verbose;
            application.Logon();
            application.CreateObjectSpace();

            await startServer.Timeout(Timeout);

            var receive   = TraceEventReceiver.TraceEvent.FirstAsync(_ => _.Method == nameof(XafApplicationRxExtensions.WhenDetailViewCreated)).SubscribeReplay();
            var broadcast = TraceEventHub.Trace.FirstAsync(_ => _.Method == nameof(XafApplicationRxExtensions.WhenDetailViewCreated))
                            .SubscribeReplay();

            using var clientWinApp = new ClientWinApp { EditorFactory = new EditorsFactory() };
            clientWinApp.AddModule <ReactiveLoggerHubModule>();
            clientWinApp.Model.BOModel.GetClass(typeof(TraceEvent)).DefaultListView.UseServerMode = false;
            clientWinApp.Logon();


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

            clientWinApp.CreateViewWindow().SetView(listView);

            await connecting.Timeout(Timeout);


            var detailViewCreated = application.WhenDetailViewCreated().FirstAsync().SubscribeReplay();



            application.NewObjectView <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();
        }
Exemple #3
0
        public async Task Display_TraceEvent_On_New_Client()
        {
            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_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));
                    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);

                    var events = listView.CollectionSource.Objects <TraceEvent>().ToArray();
                    events.FirstOrDefault(_ => _.Method == nameof(XafApplicationRXExtensions.WhenDetailViewCreated)).ShouldNotBeNull();
                    events.FirstOrDefault(_ => _.Location == nameof(ReactiveLoggerHubService)).ShouldNotBeNull();
                }
            }
        }
Exemple #4
0
        public async Task Client_Detect_When_Hub_Is_Online()
        {
            using (var clientWinApp = new ClientWinApp()){
                clientWinApp.AddModule <ReactiveLoggerHubModule>(typeof(RLH), typeof(BaseObject));
                clientWinApp.Logon();
                clientWinApp.CreateObjectSpace();

                var detectOnlineHubTrace = clientWinApp.WhenTraceOnNextEvent(nameof(ReactiveLoggerHubService.DetectOnlineHub))
                                           .SubscribeReplay();
                var detectOffline = clientWinApp.WhenTraceOnSubscribeEvent(nameof(ReactiveLoggerHubService.DetectOffLineHub)).SubscribeReplay();
                using (var application = Platform.Win.NewApplication <ReactiveLoggerHubModule>()){
                    application.AddModule <RXLoggerHubTestsModule>(nameof(Client_Detect_When_Hub_Is_Online), typeof(RLH), typeof(BaseObject));
                    application.Logon();
                    application.CreateObjectSpace();
                    await detectOnlineHubTrace.FirstAsync().Timeout(Timeout);
                }

                await detectOffline.FirstAsync().Timeout(Timeout);
            }
        }
        public async Task Display_TraceEvent_On_Running_Client()
        {
            XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.CollectClassInfos(GetType().Assembly);
            using (var clientWinApp = new ClientWinApp()){
                clientWinApp.EditorFactory = new EditorsFactory();
                clientWinApp.AddModule <ReactiveLoggerHubModule>();
                clientWinApp.Model.BOModel.GetClass(typeof(TraceEvent)).DefaultListView.UseServerMode = false;
                clientWinApp.Logon();
                var listView   = clientWinApp.NewObjectView <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().SubscribeOn(Scheduler.Default);
                    var connecting = TraceEventHub.Connecting.FirstAsync().SubscribeReplay();

                    application.AddModule <ReactiveLoggerHubModule>(nameof(Display_TraceEvent_On_Running_Client), typeof(RLH));
                    application.Model.ToReactiveModule <IModelReactiveModuleLogger>().ReactiveLogger.TraceSources[nameof(ReactiveModule)].Level = SourceLevels.Verbose;
                    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.NewObjectView <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();
                }
            }
        }
Exemple #6
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();
                }
            }
        }