From e61ba03b160c899855f843e6505d2ffd37e0abf8 Mon Sep 17 00:00:00 2001 From: Adam Ralph Date: Thu, 3 Nov 2016 09:10:14 +0100 Subject: [PATCH] revert to 20206598813d3cd987e5ed8335e680df97b9fef9 --- .gitignore | 270 +----- .../AboutViewModelTests.cs | 17 +- src/ServiceInsight.Tests/App.config | 2 +- .../ConversationsData/json5.json | 827 ------------------ .../Framework/Attachments.cs | 35 + src/ServiceInsight.Tests/JsonViewerTests.cs | 11 +- .../MessageBodyViewModelTests.cs | 29 +- .../MessageListViewModelTests.cs | 12 +- .../SearchViewModelTests.cs | 5 +- ...equenceDiagramModelCreatorTestsForJson4.cs | 22 +- ...equenceDiagramModelCreatorTestsForJson5.cs | 31 - .../ServiceControlConnectionDialogTests.cs | 80 ++ .../ServiceInsight.Tests.csproj | 30 +- .../ShellViewModelTests.cs | 30 +- .../XmlViewerViewModelTests.cs | 9 +- src/ServiceInsight.Tests/packages.config | 7 +- src/ServiceInsight/App.xaml | 2 + src/ServiceInsight/App.xaml.cs | 6 - .../DiagramLegend/DiagramLegendViewModel.cs | 10 +- .../EndpointExplorerViewModel.cs | 243 +++-- .../ServiceControlExplorerItem.cs | 4 +- src/ServiceInsight/Explorer/ExplorerItem.cs | 10 +- .../ExtensionMethods/AkavacheExtensions.cs | 141 --- .../ExtensionMethods/BuilderExtensions.cs | 6 + .../ExtensionMethods/CollectionExtensions.cs | 18 - .../ExtensionMethods/ReflectionHelper.cs | 7 - .../ExtensionMethods/StringExtensions.cs | 14 +- .../ExtensionMethods/ViewModelExtensions.cs | 44 + src/ServiceInsight/FodyWeavers.xml | 9 +- src/ServiceInsight/Framework/AsyncPump.cs | 42 - .../Framework/Attachments/Attachment.cs | 20 + .../Framework/AutofacContainer.cs | 40 - .../Behaviors/BindableSelectedItemBehavior.cs | 66 +- .../Framework/Commands/RetryMessageCommand.cs | 16 +- .../Commands/SearchByMessageIDCommand.cs | 7 +- .../Framework/Commands/ShowSagaCommand.cs | 7 +- .../Events/RefreshEndpointMessages.cs | 26 - .../Framework/Events/WorkStarted.cs | 4 +- .../Logging/CaliburnMicroLogAdapter.cs | 46 + .../Framework/Logging/LoggingConfig.cs | 32 +- .../Framework/Logging/SerilogLogger.cs | 34 - .../JsonMessageDeserializer.cs | 61 +- .../Framework/Modules/AutoAttachmentModule.cs | 26 +- .../Framework/Modules/CaliburnModule.cs | 31 + .../Framework/Modules/CoreModule.cs | 8 - .../EventAggregationAutoSubscriptionModule.cs | 23 + .../Framework/Modules/LoggerModule.cs | 14 + .../Framework/Modules/SettingsModule.cs | 2 +- .../Framework/Modules/ShellModule.cs | 9 +- .../Framework/Rx/RxConductor.cs | 65 ++ src/ServiceInsight/Framework/Rx/RxScreen.cs | 23 +- .../Framework/RxEventAggregator.cs | 35 - .../Framework/RxServiceControl.cs | 177 ---- .../SnakeCasePropertyNamesContractResolver.cs | 46 - .../UI/ScreenManager/ChoiceCommand.cs | 27 +- .../UI/ScreenManager/DialogViewModel.cs | 4 +- .../UI/ScreenManager/IWindowManagerEx.cs | 4 +- .../UI/ScreenManager/WindowManagerEx.cs | 25 +- src/ServiceInsight/Framework/WorkNotifier.cs | 37 - src/ServiceInsight/GlobalSuppressions.cs | 1 - .../LogWindow/LogWindowView.xaml.cs | 13 +- .../LogWindow/LogWindowViewModel.cs | 18 +- .../LogWindow/LoggingRichTextBoxBehavior.cs | 26 +- .../MessageFlow/ExceptionDetailViewModel.cs | 13 +- .../MessageFlow/MessageActionPopup.xaml | 78 +- .../MessageFlow/MessageFlowView.xaml | 99 ++- .../MessageFlow/MessageFlowViewModel.cs | 34 +- src/ServiceInsight/MessageFlow/MessageNode.cs | 9 +- .../MessageHeaders/MessageHeaderKeyValue.cs | 4 +- .../MessageHeaders/MessageHeadersViewModel.cs | 30 +- .../MessageList/MessageListView.xaml | 4 +- .../MessageList/MessageListView.xaml.cs | 17 +- .../MessageList/MessageListViewModel.cs | 112 +-- .../MessageList/MessageSelectionContext.cs | 34 +- .../MessageProperties/ErrorHeaderViewModel.cs | 4 +- .../GatewayHeaderViewModel.cs | 4 +- .../GeneralHeaderViewModel.cs | 4 +- .../HeaderInfoViewModelBase.cs | 11 +- .../MessageProperties/IHeaderInfoViewModel.cs | 11 + .../IPropertyDataProvider.cs | 5 +- .../MessagePropertiesView.xaml.cs | 8 +- .../MessagePropertiesViewModel.cs | 5 +- .../PerformanceHeaderViewModel.cs | 4 +- .../MessageProperties/SagaHeaderViewModel.cs | 8 +- .../MessageViewers/BaseMessageScreen.cs | 57 -- .../HexViewer/HexContentViewModel.cs | 11 +- .../MessageViewers/IMessageViewer.cs | 9 - .../JsonViewer/IJsonMessageView.cs | 9 + .../JsonViewer/JsonMessageView.xaml.cs | 3 +- .../JsonViewer/JsonMessageViewModel.cs | 43 +- .../MessageViewers/MessageBodyView.xaml | 10 +- .../MessageViewers/MessageBodyViewModel.cs | 39 +- .../XmlViewer/IXmlMessageView.cs | 9 + .../XmlViewer/XmlMessageView.xaml.cs | 5 +- .../XmlViewer/XmlMessageViewModel.cs | 50 +- src/ServiceInsight/Models/MessageInfo.cs | 4 +- src/ServiceInsight/Models/StoredMessage.cs | 2 +- .../Options/OptionsView.xaml.cs | 8 +- .../Options/OptionsViewModel.cs | 7 +- src/ServiceInsight/Saga/SagaData.cs | 5 +- src/ServiceInsight/Saga/SagaMessage.cs | 5 +- src/ServiceInsight/Saga/SagaUpdate.cs | 4 +- src/ServiceInsight/Saga/SagaUpdatedValue.cs | 8 +- src/ServiceInsight/Saga/SagaWindowView.xaml | 13 +- .../Saga/SagaWindowView.xaml.cs | 6 +- .../Saga/SagaWindowViewModel.cs | 42 +- src/ServiceInsight/Search/SearchBarView.xaml | 15 +- .../Search/SearchBarViewModel.cs | 100 +-- .../SequenceDiagram/Diagram/DiagramItem.cs | 10 +- .../SequenceDiagram/ModelCreator.cs | 22 +- .../SequenceDiagram/SequenceDiagramView.xaml | 6 +- .../SequenceDiagramViewModel.cs | 45 +- .../ServiceControl/DefaultServiceControl.cs | 28 +- .../ServiceControl/IServiceControl.cs | 2 + .../ServiceControlConnectionProvider.cs | 24 - src/ServiceInsight/ServiceInsight.csproj | 81 +- src/ServiceInsight/Shell/About.xaml.cs | 2 +- src/ServiceInsight/Shell/AboutViewModel.cs | 71 +- .../Shell/AppExceptionHandler.cs | 8 +- .../Shell/{IShell.cs => IShellView.cs} | 2 +- .../Shell/LicenseRegistrationViewModel.cs | 13 +- .../Shell/ServiceControlConnectionView.xaml | 14 +- .../ServiceControlConnectionViewModel.cs | 35 +- src/ServiceInsight/Shell/Shell.xaml | 22 +- src/ServiceInsight/Shell/Shell.xaml.cs | 2 +- src/ServiceInsight/Shell/ShellViewModel.cs | 148 +--- src/ServiceInsight/Shell/StatusBarManager.cs | 23 +- src/ServiceInsight/Startup/AppBootstrapper.cs | 111 +++ .../Startup/ConfigurationSettingsReader.cs | 6 + .../ValueConverters/ScaledValueConverter.cs | 2 +- src/ServiceInsight/packages.config | 17 +- src/Setup/ServiceInsight.aip | 578 ++++++------ src/Setup/Setup.csproj | 3 +- src/Setup/res/SI_installer_banner.jpg | Bin 10212 -> 0 bytes src/Setup/res/SI_installer_initial.jpg | Bin 25738 -> 0 bytes src/Setup/res/ServiceInsight - white.png | Bin 0 -> 5506 bytes 136 files changed, 2043 insertions(+), 3140 deletions(-) delete mode 100644 src/ServiceInsight.Tests/ConversationsData/json5.json create mode 100644 src/ServiceInsight.Tests/Framework/Attachments.cs delete mode 100644 src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson5.cs create mode 100644 src/ServiceInsight.Tests/ServiceControlConnectionDialogTests.cs delete mode 100644 src/ServiceInsight/ExtensionMethods/AkavacheExtensions.cs create mode 100644 src/ServiceInsight/ExtensionMethods/ViewModelExtensions.cs delete mode 100644 src/ServiceInsight/Framework/AsyncPump.cs create mode 100644 src/ServiceInsight/Framework/Attachments/Attachment.cs delete mode 100644 src/ServiceInsight/Framework/AutofacContainer.cs delete mode 100644 src/ServiceInsight/Framework/Events/RefreshEndpointMessages.cs create mode 100644 src/ServiceInsight/Framework/Logging/CaliburnMicroLogAdapter.cs delete mode 100644 src/ServiceInsight/Framework/Logging/SerilogLogger.cs create mode 100644 src/ServiceInsight/Framework/Modules/CaliburnModule.cs create mode 100644 src/ServiceInsight/Framework/Modules/EventAggregationAutoSubscriptionModule.cs create mode 100644 src/ServiceInsight/Framework/Modules/LoggerModule.cs create mode 100644 src/ServiceInsight/Framework/Rx/RxConductor.cs delete mode 100644 src/ServiceInsight/Framework/RxEventAggregator.cs delete mode 100644 src/ServiceInsight/Framework/RxServiceControl.cs delete mode 100644 src/ServiceInsight/Framework/SnakeCasePropertyNamesContractResolver.cs delete mode 100644 src/ServiceInsight/Framework/WorkNotifier.cs create mode 100644 src/ServiceInsight/MessageProperties/IHeaderInfoViewModel.cs delete mode 100644 src/ServiceInsight/MessageViewers/BaseMessageScreen.cs delete mode 100644 src/ServiceInsight/MessageViewers/IMessageViewer.cs create mode 100644 src/ServiceInsight/MessageViewers/JsonViewer/IJsonMessageView.cs create mode 100644 src/ServiceInsight/MessageViewers/XmlViewer/IXmlMessageView.cs rename src/ServiceInsight/Shell/{IShell.cs => IShellView.cs} (70%) create mode 100644 src/ServiceInsight/Startup/AppBootstrapper.cs create mode 100644 src/ServiceInsight/Startup/ConfigurationSettingsReader.cs delete mode 100644 src/Setup/res/SI_installer_banner.jpg delete mode 100644 src/Setup/res/SI_installer_initial.jpg create mode 100644 src/Setup/res/ServiceInsight - white.png diff --git a/.gitignore b/.gitignore index a02f02f6..5674e44c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,41 @@ -# Created by https://www.gitignore.io/api/visualstudio +nugets +chocos/ +deploy +build32 +binaries +*.vshost.* +.nu +_UpgradeReport.* +*.cache +*~ +*.swp +results +CommonAssemblyInfo.cs +lib/sqlite/System.Data.SQLite.dll +*.orig +Samples/DataBus/storage +packages +PrecompiledWeb +core-only +Release +Artifacts +LogFiles +csx +*.ncrunchproject +*.ncrunchsolution +_NCrunch_NServiceBus/* +logs +run-git.cmd +src/Chocolatey/Build/* + +installer/[F|f]iles +installer/[C|c]ustom[A|a]ctions +installer/ServiceControl-cache + +Index.dat +Storage.dat + +# Created by https://www.gitignore.io ### VisualStudio ### ## Ignore Visual Studio temporary files, build results, and @@ -10,9 +47,6 @@ *.userosscache *.sln.docstates -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -20,240 +54,30 @@ [Rr]eleases/ x64/ x86/ +build/ bld/ [Bb]in/ [Oo]bj/ -[Ll]og/ -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ +# Roslyn cache directories +*.ide/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -# NUNIT +#NUNIT *.VisualState.xml TestResult.xml -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -project.fragment.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState +# NCrunch +_NCrunch_* +.*crunch*.local.xml # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ \ No newline at end of file +src/scaffolding.config +src/Setup/ServiceInsight-cache/ \ No newline at end of file diff --git a/src/ServiceInsight.Tests/AboutViewModelTests.cs b/src/ServiceInsight.Tests/AboutViewModelTests.cs index 2638a03c..c21dd86f 100644 --- a/src/ServiceInsight.Tests/AboutViewModelTests.cs +++ b/src/ServiceInsight.Tests/AboutViewModelTests.cs @@ -1,5 +1,6 @@ namespace ServiceInsight.Tests { + using Caliburn.Micro; using NSubstitute; using NUnit.Framework; using ServiceInsight.Framework; @@ -13,6 +14,7 @@ public class AboutViewModelTests NetworkOperations networkOperations; IServiceControl serviceControl; LicenseRegistrationViewModel licenseRegistration; + AboutViewModel sut; [SetUp] public void Initialize() @@ -20,12 +22,14 @@ public void Initialize() networkOperations = Substitute.For(); serviceControl = Substitute.For(); licenseRegistration = Substitute.For(); + + sut = new AboutViewModel(networkOperations, serviceControl, licenseRegistration); } [Test] public void Should_fetch_service_control_version() { - var sut = CreateViewModel(); + ((IActivate)sut).Activate(); serviceControl.Received(1).GetVersion(); } @@ -36,7 +40,7 @@ public void Should_display_service_control_version() const string ServiceControlVersion = "0.8.0-Unstable379"; serviceControl.GetVersion().Returns(ServiceControlVersion); - var sut = CreateViewModel(); + ((IActivate)sut).Activate(); sut.ServiceControlVersion.ShouldBe(ServiceControlVersion); } @@ -44,7 +48,7 @@ public void Should_display_service_control_version() [Test] public void Should_display_application_version_number() { - var sut = CreateViewModel(); + ((IActivate)sut).Activate(); sut.AppVersion.ShouldNotBe(null); sut.AppVersion.ShouldNotBeEmpty(); @@ -53,15 +57,10 @@ public void Should_display_application_version_number() [Test] public void Should_display_short_commit_hash() { - var sut = CreateViewModel(); + ((IActivate)sut).Activate(); sut.CommitHash.ShouldNotBe(null); sut.CommitHash.Length.ShouldBe(7); } - - private AboutViewModel CreateViewModel() - { - return new AboutViewModel(networkOperations, serviceControl, licenseRegistration); - } } } \ No newline at end of file diff --git a/src/ServiceInsight.Tests/App.config b/src/ServiceInsight.Tests/App.config index 3fa0d789..089a94c7 100644 --- a/src/ServiceInsight.Tests/App.config +++ b/src/ServiceInsight.Tests/App.config @@ -51,7 +51,7 @@ - + diff --git a/src/ServiceInsight.Tests/ConversationsData/json5.json b/src/ServiceInsight.Tests/ConversationsData/json5.json deleted file mode 100644 index 06125d96..00000000 --- a/src/ServiceInsight.Tests/ConversationsData/json5.json +++ /dev/null @@ -1,827 +0,0 @@ -[ - { - "id": "d4569b84-7913-44cd-4133-d2b87dbc3820", - "message_id": "a3f893de-25e0-4838-8d13-a655009bc7df", - "message_type": "RelocationProcessCompletedNotification", - "sending_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "receiving_endpoint": { - "name": "CrmDefault", - "host_id": "72220399-e091-2c8e-96d4-6d8199721d1f", - "host": "MachineOne" - }, - "time_sent": "2016-08-01T07:27:10.822878Z", - "processed_at": "2016-08-01T07:27:10.936081Z", - "critical_time": "00:00:00.1132030", - "processing_time": "00:00:00.0468000", - "delivery_time": "00:00:00.0664030", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "a3f893de-25e0-4838-8d13-a655009bc7df" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "345c6add-3337-41bf-8faa-a655009bc7e4" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Publish" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:10:822878 Z" - }, - { - "key": "NServiceBus.OriginatingSagaId", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "NServiceBus.OriginatingSagaType", - "value": "RelocationSaga, RelocationSaga.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "RelocationProcessCompletedNotification, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "a3f893de-25e0-4838-8d13-a655009bc7df\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "699659a9-6bdd-4cbc-b425-a655009bc7c8" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "CrmDefault@MachineOne" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:10:889281 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:10:936081 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "MachineOne" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "CrmDefault" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RelocationSaga@SERVICEBUS" - } - ], - "status": "successful", - "message_intent": "publish", - "body_url": "/messages/a3f893de-25e0-4838-8d13-a655009bc7df/body", - "body_size": 113, - "originates_from_saga": { - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - }, - { - "id": "21a2086c-e34b-d73c-1f59-61e413d5f78e", - "message_id": "699659a9-6bdd-4cbc-b425-a655009bc7c8", - "message_type": "RelocationOrderRequisitionProcessingSucceededNotification", - "sending_endpoint": { - "name": "SubscriberEndpoint", - "host_id": "91892910-93f0-3665-c53b-cfc8dbb8702e", - "host": "Machine-P1" - }, - "receiving_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "time_sent": "2016-08-01T07:27:10.745191Z", - "processed_at": "2016-08-01T07:27:10.854119Z", - "critical_time": "00:00:00.1089280", - "processing_time": "00:00:00.0312410", - "delivery_time": "00:00:00.0776870", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "699659a9-6bdd-4cbc-b425-a655009bc7c8" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "b11f40f3-2c8e-4b34-b806-a655009bc7cd" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Publish" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:10:745191 Z" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "RelocationOrderRequisitionProcessingSucceededNotification, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "699659a9-6bdd-4cbc-b425-a655009bc7c8\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "8f096ac6-37e2-4152-9725-a655009bc224" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "Machine-P1" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "SubscriberEndpoint" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "RelocationSaga@SERVICEBUS" - }, - { - "key": "NServiceBus.InvokedSagas", - "value": "RelocationSaga:3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "ServiceControl.SagaStateChange", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7:Completed" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:10:822878 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:10:854119 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "SubscriberEndpoint@Machine-P1" - } - ], - "status": "successful", - "message_intent": "publish", - "body_url": "/messages/699659a9-6bdd-4cbc-b425-a655009bc7c8/body", - "body_size": 131, - "invoked_sagas": [ - { - "change_status": "Completed", - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - ] - }, - { - "id": "32f74d3a-d910-cb7b-660c-6ec115b77777", - "message_id": "8f096ac6-37e2-4152-9725-a655009bc224", - "message_type": "ProcessRelocationOrderRequisitionCommand", - "sending_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "receiving_endpoint": { - "name": "SubscriberEndpoint", - "host_id": "91892910-93f0-3665-c53b-cfc8dbb8702e", - "host": "Machine-P1" - }, - "time_sent": "2016-08-01T07:27:05.932365Z", - "processed_at": "2016-08-01T07:27:10.776445Z", - "critical_time": "00:00:04.8440800", - "processing_time": "00:00:04.7500890", - "delivery_time": "00:00:00.0939910", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "8f096ac6-37e2-4152-9725-a655009bc224" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "8f096ac6-37e2-4152-9725-a655009bc224" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Send" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:05:932365 Z" - }, - { - "key": "NServiceBus.OriginatingSagaId", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "NServiceBus.OriginatingSagaType", - "value": "RelocationSaga, RelocationSaga.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "ProcessRelocationOrderRequisitionCommand, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "8f096ac6-37e2-4152-9725-a655009bc224\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "045e4d09-4aef-42f7-b82b-a655009bc212" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "SubscriberEndpoint@Machine-P1" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:06:026356 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:10:776445 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "Machine-P1" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "SubscriberEndpoint" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RelocationSaga@SERVICEBUS" - } - ], - "status": "successful", - "message_intent": "send", - "body_url": "/messages/8f096ac6-37e2-4152-9725-a655009bc224/body", - "body_size": 2937, - "originates_from_saga": { - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - }, - { - "id": "05dd0d5a-e14f-de2b-287d-67ce73f5c7b8", - "message_id": "045e4d09-4aef-42f7-b82b-a655009bc212", - "message_type": "GetRequestorIdByPersonIdResponse", - "sending_endpoint": { - "name": "RequestorIdentificationManagerRouter", - "host_id": "84585ccc-a7a9-8cd2-ea88-56a9e0ecd8ff", - "host": "MachineTwo-P1" - }, - "receiving_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "time_sent": "2016-08-01T07:27:05.870717Z", - "processed_at": "2016-08-01T07:27:05.947913Z", - "critical_time": "00:00:00.0771960", - "processing_time": "00:00:00.0155480", - "delivery_time": "00:00:00.0616480", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "045e4d09-4aef-42f7-b82b-a655009bc212" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Reply" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.9" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:05:870717 Z" - }, - { - "key": "NServiceBus.SagaId", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "NServiceBus.SagaType", - "value": "RelocationSaga, RelocationSaga.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "GetRequestorIdByPersonIdResponse, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "MachineTwo-P1" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RequestorIdentificationManagerRouter" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "RelocationSaga@SERVICEBUS" - }, - { - "key": "NServiceBus.InvokedSagas", - "value": "RelocationSaga:3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "ServiceControl.SagaStateChange", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7:Updated" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:05:932365 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:05:947913 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RequestorIdentificationManagerRouter@MachineTwo-P1" - } - ], - "status": "successful", - "message_intent": "reply", - "body_url": "/messages/045e4d09-4aef-42f7-b82b-a655009bc212/body", - "body_size": 193, - "invoked_sagas": [ - { - "change_status": "Updated", - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - ] - }, - { - "id": "80fb01be-d21e-3855-36b1-b1399e5cc327", - "message_id": "af05c484-4339-461b-b1a5-a655009bc1ec", - "message_type": "GetRequestorIdByPersonIdRequest", - "sending_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "receiving_endpoint": { - "name": "RequestorIdentificationManagerRouter", - "host_id": "84585ccc-a7a9-8cd2-ea88-56a9e0ecd8ff", - "host": "MachineTwo-P1" - }, - "time_sent": "2016-08-01T07:27:05.744777Z", - "processed_at": "2016-08-01T07:27:05.870717Z", - "critical_time": "00:00:00.1259400", - "processing_time": "00:00:00.0781240", - "delivery_time": "00:00:00.0478160", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Send" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:05:744777 Z" - }, - { - "key": "NServiceBus.OriginatingSagaId", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "NServiceBus.OriginatingSagaType", - "value": "RelocationSaga, RelocationSaga.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "GetRequestorIdByPersonIdRequest, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "af05c484-4339-461b-b1a5-a655009bc1ec\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "RequestorIdentificationManagerRouter@MachineTwo-P1" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:05:792593 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:05:870717 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "MachineTwo-P1" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "RequestorIdentificationManagerRouter" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RelocationSaga@SERVICEBUS" - } - ], - "status": "successful", - "message_intent": "send", - "body_url": "/messages/af05c484-4339-461b-b1a5-a655009bc1ec/body", - "body_size": 243, - "originates_from_saga": { - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - }, - { - "id": "4da23d3e-1c98-a135-de3b-7800aa72c0ff", - "message_id": "2a87c3e6-9ced-40d2-ab3d-a655009bc1e7", - "message_type": "RelocationProcessStartedNotification", - "sending_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "receiving_endpoint": { - "name": "CrmDefault", - "host_id": "72220399-e091-2c8e-96d4-6d8199721d1f", - "host": "MachineOne" - }, - "time_sent": "2016-08-01T07:27:05.729168Z", - "processed_at": "2016-08-01T07:27:05.912881Z", - "critical_time": "00:00:00.1837130", - "processing_time": "00:00:00.1248000", - "delivery_time": "00:00:00.0589130", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "2a87c3e6-9ced-40d2-ab3d-a655009bc1e7" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "5531daa2-4bae-405d-8aad-a655009bc1e7" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Publish" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:05:729168 Z" - }, - { - "key": "NServiceBus.OriginatingSagaId", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "NServiceBus.OriginatingSagaType", - "value": "RelocationSaga, RelocationSaga.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "RelocationProcessStartedNotification, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "2a87c3e6-9ced-40d2-ab3d-a655009bc1e7\\0" - }, - { - "key": "NServiceBus.RelatedTo", - "value": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "Company\\intserviceaccount" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "CrmDefault@MachineOne" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:05:788081 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:05:912881 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "MachineOne" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "CrmDefault" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RelocationSaga@SERVICEBUS" - } - ], - "status": "successful", - "message_intent": "publish", - "body_url": "/messages/2a87c3e6-9ced-40d2-ab3d-a655009bc1e7/body", - "body_size": 2839, - "originates_from_saga": { - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - }, - { - "id": "5a59b85e-e1ea-4e25-aeb3-e082ad697738", - "message_id": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de", - "message_type": "StartRelocationProcessCommand", - "sending_endpoint": { - "name": "RelocationOrderManager", - "host_id": "9d4a9c3c-5c8f-17e8-d509-7d114281f829", - "host": "MachineTwo-P1" - }, - "receiving_endpoint": { - "name": "RelocationSaga", - "host_id": "6f12632d-f9b3-fbde-fafa-531a8a29ad9f", - "host": "SERVICEBUS" - }, - "time_sent": "2016-08-01T07:27:05.698841Z", - "processed_at": "2016-08-01T07:27:05.760418Z", - "critical_time": "00:00:00.0615770", - "processing_time": "00:00:00.0312500", - "delivery_time": "00:00:00.0303270", - "is_system_message": false, - "conversation_id": "fdbe054e-d6b9-4a37-9208-a655009bc1de", - "headers": [ - { - "key": "NServiceBus.MessageId", - "value": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de" - }, - { - "key": "NServiceBus.CorrelationId", - "value": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de" - }, - { - "key": "NServiceBus.MessageIntent", - "value": "Send" - }, - { - "key": "NServiceBus.Version", - "value": "5.2.14" - }, - { - "key": "NServiceBus.TimeSent", - "value": "2016-08-01 07:27:05:698841 Z" - }, - { - "key": "NServiceBus.ContentType", - "value": "application/json" - }, - { - "key": "NServiceBus.EnclosedMessageTypes", - "value": "StartRelocationProcessCommand, ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" - }, - { - "key": "CorrId", - "value": "2c9ecac1-0d9d-4fec-a2c8-a655009bc1de\\0" - }, - { - "key": "NServiceBus.ConversationId", - "value": "fdbe054e-d6b9-4a37-9208-a655009bc1de" - }, - { - "key": "WinIdName", - "value": "CN=Prod.Client.RelocationOrderManager.Seas.Local, OU=Integration, O=SEAS-NVE, C=DK; 87B2EA188FAAD9705758A5E5FBC2882E6CC03047" - }, - { - "key": "NServiceBus.OriginatingMachine", - "value": "MachineTwo-P1" - }, - { - "key": "NServiceBus.OriginatingEndpoint", - "value": "RelocationOrderManager" - }, - { - "key": "NServiceBus.ReplyToAddress", - "value": "RelocationSaga@SERVICEBUS" - }, - { - "key": "NServiceBus.InvokedSagas", - "value": "RelocationSaga:3dfc648e-0e3b-4296-8623-a655009bc1e7" - }, - { - "key": "ServiceControl.SagaStateChange", - "value": "3dfc648e-0e3b-4296-8623-a655009bc1e7:New" - }, - { - "key": "NServiceBus.ProcessingStarted", - "value": "2016-08-01 07:27:05:729168 Z" - }, - { - "key": "NServiceBus.ProcessingEnded", - "value": "2016-08-01 07:27:05:760418 Z" - }, - { - "key": "NServiceBus.ProcessingMachine", - "value": "SERVICEBUS" - }, - { - "key": "NServiceBus.ProcessingEndpoint", - "value": "RelocationSaga" - }, - { - "key": "NServiceBus.OriginatingAddress", - "value": "RelocationOrderManager@MachineTwo-P1" - } - ], - "status": "successful", - "message_intent": "send", - "body_url": "/messages/2c9ecac1-0d9d-4fec-a2c8-a655009bc1de/body", - "body_size": 2826, - "invoked_sagas": [ - { - "change_status": "New", - "saga_type": "RelocationSaga", - "saga_id": "3dfc648e-0e3b-4296-8623-a655009bc1e7" - } - ] - } -] \ No newline at end of file diff --git a/src/ServiceInsight.Tests/Framework/Attachments.cs b/src/ServiceInsight.Tests/Framework/Attachments.cs new file mode 100644 index 00000000..ddc53555 --- /dev/null +++ b/src/ServiceInsight.Tests/Framework/Attachments.cs @@ -0,0 +1,35 @@ +namespace ServiceInsight.Tests.Framework +{ + using System; + using NUnit.Framework; + using ServiceInsight.Framework.Attachments; + + [TestFixture] + public class Attachments + { + class TestAttachment : Attachment + { + readonly object original; + + public TestAttachment(object original) + { + this.original = original; + } + + protected override void OnAttach() + { + Assert.AreEqual(original, instance); + } + } + + [Test] + public void Attachment_sets_instance_before_onattach() + { + var testObject = new object(); + + IAttachment attachment = new TestAttachment(testObject); + + attachment.AttachTo(testObject); + } + } +} \ No newline at end of file diff --git a/src/ServiceInsight.Tests/JsonViewerTests.cs b/src/ServiceInsight.Tests/JsonViewerTests.cs index 307c525c..af64d067 100644 --- a/src/ServiceInsight.Tests/JsonViewerTests.cs +++ b/src/ServiceInsight.Tests/JsonViewerTests.cs @@ -1,9 +1,8 @@ namespace ServiceInsight.Tests { - using MessageViewers; + using Caliburn.Micro; using NSubstitute; using NUnit.Framework; - using Pirac; using ServiceInsight.MessageViewers.JsonViewer; using ServiceInsight.Models; using ServiceInsight.ServiceControl; @@ -12,14 +11,14 @@ public class JsonViewerTests { JsonMessageViewModel viewModel; - IMessageViewer view; + IJsonMessageView view; [SetUp] public void TestInitialize() { - view = Substitute.For(); + view = Substitute.For(); viewModel = new JsonMessageViewModel(); - ((IActivatable)viewModel).Activate(); + ((IActivate)viewModel).Activate(); } [Test] @@ -27,7 +26,7 @@ public void Should_display_json_message() { const string TestMessage = @"[{""$type"":""NSB.Messages.CRM.RegisterCustomer, NSB.Messages"",""Name"":""Hadi"",""Password"":""123456"",""EmailAddress"":""h.eskandari@gmail.com"",""RegistrationDate"":""2013-01-28T03:24:05.0546437Z""}]"; - ((IHaveView)viewModel).AttachView(view); + ((IViewAware)viewModel).AttachView(view); viewModel.SelectedMessage = new MessageBody { Body = new PresentationBody { Text = TestMessage } }; diff --git a/src/ServiceInsight.Tests/MessageBodyViewModelTests.cs b/src/ServiceInsight.Tests/MessageBodyViewModelTests.cs index 0a720d7b..f5029135 100644 --- a/src/ServiceInsight.Tests/MessageBodyViewModelTests.cs +++ b/src/ServiceInsight.Tests/MessageBodyViewModelTests.cs @@ -1,9 +1,11 @@ namespace ServiceInsight.Tests { using System; + using Caliburn.Micro; + using Microsoft.Reactive.Testing; using NSubstitute; using NUnit.Framework; - using ServiceInsight.Framework; + using ReactiveUI.Testing; using ServiceInsight.Framework.Events; using ServiceInsight.MessageList; using ServiceInsight.MessageViewers; @@ -16,8 +18,7 @@ [TestFixture] public class MessageBodyViewModelTests { - IRxEventAggregator eventAggregator; - IWorkNotifier workNotifier; + IEventAggregator eventAggregator; IServiceControl serviceControl; HexContentViewModel hexContent; JsonMessageViewModel jsonContent; @@ -28,31 +29,35 @@ public class MessageBodyViewModelTests [SetUp] public void TestInitialize() { - eventAggregator = Substitute.For(); - workNotifier = Substitute.For(); + eventAggregator = Substitute.For(); serviceControl = Substitute.For(); hexContent = Substitute.For(); jsonContent = Substitute.For(); xmlContent = Substitute.For(); selection = new MessageSelectionContext(eventAggregator); - messageBodyFunc = () => new MessageBodyViewModel(hexContent, jsonContent, xmlContent, serviceControl, eventAggregator, workNotifier, selection); + messageBodyFunc = () => new MessageBodyViewModel(hexContent, jsonContent, xmlContent, serviceControl, eventAggregator, selection); } [Test] public void Should_load_body_content_when_body_tab_is_already_selected() { - const string uri = "http://localhost:3333/api/somemessageid/body"; + new TestScheduler().With(sched => + { + const string uri = "http://localhost:3333/api/somemessageid/body"; - var messageBody = messageBodyFunc(); + var messageBody = messageBodyFunc(); - messageBody.Handle(new BodyTabSelectionChanged(true)); + messageBody.Handle(new BodyTabSelectionChanged(true)); - selection.SelectedMessage = new StoredMessage { BodyUrl = uri }; + selection.SelectedMessage = new StoredMessage { BodyUrl = uri }; - messageBody.Handle(new SelectedMessageChanged()); + messageBody.Handle(new SelectedMessageChanged()); - serviceControl.Received(1).LoadBody(selection.SelectedMessage); + sched.AdvanceByMs(500); + + serviceControl.Received(1).LoadBody(selection.SelectedMessage); + }); } [Test] diff --git a/src/ServiceInsight.Tests/MessageListViewModelTests.cs b/src/ServiceInsight.Tests/MessageListViewModelTests.cs index 09c53d00..8e64e404 100644 --- a/src/ServiceInsight.Tests/MessageListViewModelTests.cs +++ b/src/ServiceInsight.Tests/MessageListViewModelTests.cs @@ -2,6 +2,7 @@ { using System; using System.Collections.Generic; + using Caliburn.Micro; using NSubstitute; using NUnit.Framework; using ServiceInsight.Explorer.EndpointExplorer; @@ -17,8 +18,7 @@ [TestFixture] public class MessageListViewModelTests { - IRxEventAggregator eventAggregator; - IWorkNotifier workNotifier; + IEventAggregator eventAggregator; IServiceControl serviceControl; SearchBarViewModel searchBar; Func messageListFunc; @@ -27,13 +27,11 @@ public class MessageListViewModelTests [SetUp] public void TestInitialize() { - eventAggregator = Substitute.For(); - workNotifier = Substitute.For(); + eventAggregator = Substitute.For(); serviceControl = Substitute.For(); searchBar = Substitute.For(); clipboard = Substitute.For(); messageListFunc = () => new MessageListViewModel(eventAggregator, - workNotifier, serviceControl, searchBar, Substitute.For(), @@ -42,7 +40,6 @@ public void TestInitialize() } [Test] - [Ignore("Needs Pirac testing to set schedulers")] public void Should_load_the_messages_from_the_endpoint() { var endpoint = new Endpoint { Host = "localhost", Name = "Service" }; @@ -62,7 +59,8 @@ public void Should_load_the_messages_from_the_endpoint() messageList.Handle(new SelectedExplorerItemChanged(new AuditEndpointExplorerItem(endpoint))); - workNotifier.Received(1).NotifyOfWork(Arg.Any()); + eventAggregator.Received(1).PublishOnUIThread(Arg.Any()); + eventAggregator.Received(1).PublishOnUIThread(Arg.Any()); messageList.Rows.Count.ShouldBe(2); searchBar.IsVisible.ShouldBe(true); } diff --git a/src/ServiceInsight.Tests/SearchViewModelTests.cs b/src/ServiceInsight.Tests/SearchViewModelTests.cs index 9ed1e81c..4d98d811 100644 --- a/src/ServiceInsight.Tests/SearchViewModelTests.cs +++ b/src/ServiceInsight.Tests/SearchViewModelTests.cs @@ -3,7 +3,6 @@ using NSubstitute; using NUnit.Framework; using ServiceInsight.Explorer.EndpointExplorer; - using ServiceInsight.Framework; using ServiceInsight.Framework.Events; using ServiceInsight.Framework.Settings; using ServiceInsight.Models; @@ -17,15 +16,13 @@ public class SearchViewModelTests SearchBarViewModel viewModel; CommandLineArgParser argParser; ISettingsProvider settingProvider; - IRxEventAggregator eventAggregator; [SetUp] public void TestInitialize() { argParser = Substitute.For(); settingProvider = Substitute.For(); - eventAggregator = Substitute.For(); - viewModel = new SearchBarViewModel(argParser, settingProvider, eventAggregator); + viewModel = new SearchBarViewModel(argParser, settingProvider); } [Test] diff --git a/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson4.cs b/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson4.cs index 6b79dc17..e6fc6625 100644 --- a/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson4.cs +++ b/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson4.cs @@ -31,18 +31,18 @@ public void ShouldHaveStartOfConversationAsFirstHandler() public void ShouldHaveHandlersProperlyOrdered() { Assert.AreEqual(null, ModelCreator.Handlers[0].Name); - Assert.AreEqual("LogCRMAudit", ModelCreator.Handlers[1].Name); - Assert.AreEqual("UserSignupRequestAccepted", ModelCreator.Handlers[2].Name); - Assert.AreEqual("CreateCRMAccountRequest", ModelCreator.Handlers[3].Name); + Assert.AreEqual("UserSignupRequestAccepted", ModelCreator.Handlers[1].Name); + Assert.AreEqual("CreateCRMAccountRequest", ModelCreator.Handlers[2].Name); + Assert.AreEqual("CreateCRMAccountResponse", ModelCreator.Handlers[3].Name); Assert.AreEqual("CreateCRMContactRequest", ModelCreator.Handlers[4].Name); - Assert.AreEqual("ADUserCreated", ModelCreator.Handlers[5].Name); - Assert.AreEqual("CreateCRMAccountResponse", ModelCreator.Handlers[6].Name); - Assert.AreEqual("CreateCRMContactCreatedResponse", ModelCreator.Handlers[7].Name); - Assert.AreEqual("StoreUserActivationKeyInCache", ModelCreator.Handlers[8].Name); - Assert.AreEqual("LinkCRMAccountAndContactRequest", ModelCreator.Handlers[9].Name); - Assert.AreEqual("LinkCRMAccountAndContactResponse", ModelCreator.Handlers[10].Name); - Assert.AreEqual("NewAccountCreated", ModelCreator.Handlers[11].Name); - Assert.AreEqual("SendAddAccountEmailRequestAccepted", ModelCreator.Handlers[12].Name); + Assert.AreEqual("CreateCRMContactCreatedResponse", ModelCreator.Handlers[5].Name); + Assert.AreEqual("LinkCRMAccountAndContactRequest", ModelCreator.Handlers[6].Name); + Assert.AreEqual("LinkCRMAccountAndContactResponse", ModelCreator.Handlers[7].Name); + Assert.AreEqual("LogCRMAudit", ModelCreator.Handlers[8].Name); + Assert.AreEqual("NewAccountCreated", ModelCreator.Handlers[9].Name); + Assert.AreEqual("SendAddAccountEmailRequestAccepted", ModelCreator.Handlers[10].Name); + Assert.AreEqual("ADUserCreated", ModelCreator.Handlers[11].Name); + Assert.AreEqual("StoreUserActivationKeyInCache", ModelCreator.Handlers[12].Name); } } } \ No newline at end of file diff --git a/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson5.cs b/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson5.cs deleted file mode 100644 index d8b44921..00000000 --- a/src/ServiceInsight.Tests/SequenceDiagramModelCreatorTestsForJson5.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace ServiceInsight.Tests -{ - using System.Linq; - using ConversationsData; - using NUnit.Framework; - - [TestFixture] - class SequenceDiagramModelCreatorTestsForJson5 : SequenceDiagramModelCreatorTestsFromJson - { - public SequenceDiagramModelCreatorTestsForJson5() - : base("json5.json") - { - } - - [Test] - public void ShouldHaveStartOfConversationAsFirstHandler() - { - Assert.AreEqual(SequenceDiagram.ModelCreator.ConversationStartHandlerName, ModelCreator.Handlers[0].ID); - Assert.AreEqual(null, ModelCreator.Handlers[0].Name); - } - - [Test] - public void StartShouldHappenBeforeCompleted() - { - var startHandler = ModelCreator.Handlers.Single(h => h.Name == "RelocationProcessStartedNotification"); - var endHandler = ModelCreator.Handlers.Single(h => h.Name == "RelocationProcessCompletedNotification"); - - Assert.Less(ModelCreator.Handlers.IndexOf(startHandler), ModelCreator.Handlers.IndexOf(endHandler)); - } - } -} \ No newline at end of file diff --git a/src/ServiceInsight.Tests/ServiceControlConnectionDialogTests.cs b/src/ServiceInsight.Tests/ServiceControlConnectionDialogTests.cs new file mode 100644 index 00000000..c38afc1e --- /dev/null +++ b/src/ServiceInsight.Tests/ServiceControlConnectionDialogTests.cs @@ -0,0 +1,80 @@ +namespace ServiceInsight.Tests +{ + using Autofac; + using Caliburn.Micro; + using NSubstitute; + using NUnit.Framework; + using ServiceInsight.Framework.Settings; + using ServiceInsight.ServiceControl; + using ServiceInsight.Settings; + using ServiceInsight.Shell; + using Shouldly; + + [TestFixture] + public class ServiceControlConnectionDialogTests + { + IServiceControl serviceControl; + ShellViewModel shell; + ISettingsProvider settingsProvider; + IContainer container; + ServiceControlConnectionProvider connection; + ProfilerSettings storedSetting; + ServiceControlConnectionViewModel connectTo; + + [SetUp] + public void TestInitialize() + { + shell = Substitute.For(); + serviceControl = Substitute.For(); + settingsProvider = Substitute.For(); + connection = Substitute.For(); + container = RegisterContainer(); + storedSetting = GetReloadedSettings(); + settingsProvider.GetSettings().Returns(storedSetting); + connectTo = new ServiceControlConnectionViewModel(settingsProvider, container) { Parent = shell }; //TODO: Do we need to pass the full container here? + } + + [Test] + public void Should_be_able_to_connect_to_a_valid_service() + { + ((IActivate)connectTo).Activate(); + connectTo.ServiceUrl = "http://localhost:8080/managemnetApi"; + connectTo.Accept(); + + connectTo.CanAccept().ShouldBe(true); + connectTo.IsAddressValid.ShouldBe(true); + } + + [Test] + public void Should_store_connection_address_and_add_it_to_recent_entries() + { + ((IActivate)connectTo).Activate(); + connectTo.ServiceUrl = "http://localhost:8080/managemnetApi"; + connectTo.Accept(); + + settingsProvider.Received().SaveSettings(Arg.Any()); + storedSetting.RecentServiceControlEntries.Count.ShouldBe(3); + storedSetting.RecentServiceControlEntries.ShouldContain("http://localhost:8080/managemnetApi"); + } + + ProfilerSettings GetReloadedSettings() + { + var settings = new ProfilerSettings(); + + settings.RecentServiceControlEntries.Add("http://localhost/api"); + settings.RecentServiceControlEntries.Add("http://othermachine:8888/api"); + + return settings; + } + + IContainer RegisterContainer() + { + var builder = new ContainerBuilder(); + + builder.RegisterInstance(serviceControl); + builder.RegisterInstance(connection); + + return builder.Build(); + } + } +} \ No newline at end of file diff --git a/src/ServiceInsight.Tests/ServiceInsight.Tests.csproj b/src/ServiceInsight.Tests/ServiceInsight.Tests.csproj index d324518f..a9a942f3 100644 --- a/src/ServiceInsight.Tests/ServiceInsight.Tests.csproj +++ b/src/ServiceInsight.Tests/ServiceInsight.Tests.csproj @@ -46,8 +46,12 @@ False ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll - - ..\packages\DynamicData.4.8.1.1181\lib\net45\DynamicData.dll + + ..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll + True + + + ..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll True @@ -63,12 +67,15 @@ ..\packages\NUnit.3.2.1\lib\net45\nunit.framework.dll True - - ..\packages\Pirac.0.8.7\lib\Pirac.dll - True - + + False + ..\packages\reactiveui-core.5.5.1\lib\Portable-Net45+WinRT45+WP8\ReactiveUI.dll + + + ..\packages\reactiveui-testing.5.5.1\lib\net45\ReactiveUI.Testing.dll + ..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll True @@ -107,10 +114,6 @@ False ..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll - - ..\packages\Rx-XAML.2.2.5\lib\net45\System.Reactive.Windows.Threading.dll - True - @@ -124,6 +127,7 @@ + @@ -132,8 +136,8 @@ - + @@ -147,7 +151,6 @@ - @@ -162,5 +165,8 @@ ServiceInsight + + + \ No newline at end of file diff --git a/src/ServiceInsight.Tests/ShellViewModelTests.cs b/src/ServiceInsight.Tests/ShellViewModelTests.cs index 2263932f..cb20d2eb 100644 --- a/src/ServiceInsight.Tests/ShellViewModelTests.cs +++ b/src/ServiceInsight.Tests/ShellViewModelTests.cs @@ -1,14 +1,12 @@ namespace ServiceInsight.Tests { using System; + using Caliburn.Micro; using global::ServiceInsight.SequenceDiagram; using NSubstitute; using NUnit.Framework; using Particular.Licensing; - using Pirac; - using ServiceControl; using ServiceInsight.Explorer.EndpointExplorer; - using ServiceInsight.Framework; using ServiceInsight.Framework.Events; using ServiceInsight.Framework.Licensing; using ServiceInsight.Framework.Settings; @@ -26,7 +24,7 @@ using ServiceInsight.Startup; using Shouldly; - public interface IShellViewStub : IShell + public interface IShellViewStub : IShellView { bool IsOpen { get; set; } @@ -42,7 +40,7 @@ public class ShellViewModelTests MessageListViewModel messageList; MessageFlowViewModel messageFlow; SagaWindowViewModel sagaWindow; - IRxEventAggregator eventAggregator; + IEventAggregator eventAggregator; StatusBarManager statusbarManager; MessageBodyViewModel messageBodyView; MessageHeadersViewModel headerView; @@ -62,7 +60,7 @@ public void TestInitialize() endpointExplorer = Substitute.For(); messageList = Substitute.For(); statusbarManager = Substitute.For(); - eventAggregator = Substitute.For(); + eventAggregator = Substitute.For(); messageFlow = Substitute.For(); sagaWindow = Substitute.For(); messageBodyView = Substitute.For(); @@ -86,7 +84,6 @@ public void TestInitialize() () => Substitute.For(), statusbarManager, eventAggregator, - Substitute.For(), licenseManager, messageFlow, sagaWindow, @@ -94,15 +91,11 @@ public void TestInitialize() headerView, sequenceDiagramView, settingsProvider, - Substitute.For(), - Substitute.For(), - Substitute.For(), messageProperties, logWindow, - Substitute.For(), commandLineArgParser); - ((IHaveView)shell).AttachView(view); + ((IViewAware)shell).AttachView(view); } CommandLineArgParser MockEmptyStartupOptions() @@ -115,14 +108,12 @@ CommandLineArgParser MockEmptyStartupOptions() } [Test] - [Ignore("Need to fix test to support observables.")] public void Should_reload_stored_layout() { view.Received().OnRestoreLayout(settingsProvider); } [Test] - [Ignore("Need to fix test to support observables.")] public void Should_still_report_work_in_progress_when_only_part_of_the_work_is_finished() { shell.Handle(new WorkStarted("Some Work")); @@ -134,7 +125,6 @@ public void Should_still_report_work_in_progress_when_only_part_of_the_work_is_f } [Test] - [Ignore("Need to fix test to support observables.")] public void Should_finish_all_the_works_in_progress_when_the_work_is_finished() { shell.Handle(new WorkStarted()); @@ -146,18 +136,15 @@ public void Should_finish_all_the_works_in_progress_when_the_work_is_finished() } [Test] - [Ignore("Need to fix test to support observables.")] public void Deactivating_shell_saves_layout() { - ((IActivatable)shell).Activate(); + ((IScreen)shell).Activate(); - ((IActivatable)shell).Deactivate(true); + ((IScreen)shell).Deactivate(true); view.Received().OnSaveLayout(settingsProvider); } - [Test] - [Ignore("Need to fix test to support observables.")] public void Should_track_selected_explorer() { var selected = new AuditEndpointExplorerItem(new Endpoint { Name = "Sales" }); @@ -169,7 +156,6 @@ public void Should_track_selected_explorer() } [Test] - [Ignore("Need to fix test to support observables.")] public void Should_validate_trial_license() { const string RegisteredUser = "John Doe"; @@ -194,7 +180,7 @@ public void Should_validate_trial_license() [TearDown] public void TestCleanup() { - ((IActivatable)shell).Deactivate(true); + ((IScreen)shell).Deactivate(true); } static ProfilerSettings DefaultAppSetting() => new ProfilerSettings diff --git a/src/ServiceInsight.Tests/XmlViewerViewModelTests.cs b/src/ServiceInsight.Tests/XmlViewerViewModelTests.cs index ec664bae..66a03dc7 100644 --- a/src/ServiceInsight.Tests/XmlViewerViewModelTests.cs +++ b/src/ServiceInsight.Tests/XmlViewerViewModelTests.cs @@ -1,9 +1,8 @@ namespace ServiceInsight.Tests { - using MessageViewers; + using Caliburn.Micro; using NSubstitute; using NUnit.Framework; - using Pirac; using ServiceInsight.MessageViewers.XmlViewer; using ServiceInsight.Models; using ServiceInsight.ServiceControl; @@ -13,15 +12,15 @@ public class XmlViewerViewModelTests { XmlMessageViewModel viewModel; - IMessageViewer view; + IXmlMessageView view; const string TestMessage = ""; [SetUp] public void TestInitialize() { - view = Substitute.For(); + view = Substitute.For(); viewModel = new XmlMessageViewModel(); - ((IActivatable)viewModel).Activate(); + ((IActivate)viewModel).Activate(); } [Test] diff --git a/src/ServiceInsight.Tests/packages.config b/src/ServiceInsight.Tests/packages.config index 1cfd5ffa..e829d8cd 100644 --- a/src/ServiceInsight.Tests/packages.config +++ b/src/ServiceInsight.Tests/packages.config @@ -1,10 +1,12 @@  - + + - + + @@ -12,7 +14,6 @@ - diff --git a/src/ServiceInsight/App.xaml b/src/ServiceInsight/App.xaml index ebbb61a5..99c9a3d9 100644 --- a/src/ServiceInsight/App.xaml +++ b/src/ServiceInsight/App.xaml @@ -166,6 +166,8 @@ + + - + - + - + @@ -72,7 +72,9 @@ http://docs.particular.net/servicecontrol/creating-config-file + + diff --git a/src/ServiceInsight/MessageViewers/MessageBodyViewModel.cs b/src/ServiceInsight/MessageViewers/MessageBodyViewModel.cs index 19d1bf31..1f3f2319 100644 --- a/src/ServiceInsight/MessageViewers/MessageBodyViewModel.cs +++ b/src/ServiceInsight/MessageViewers/MessageBodyViewModel.cs @@ -1,11 +1,8 @@ namespace ServiceInsight.MessageViewers { - using System; using System.Collections.Generic; - + using Caliburn.Micro; using ExtensionMethods; - using Framework; - using Framework.Rx; using HexViewer; using JsonViewer; using ServiceInsight.Framework.Events; @@ -13,11 +10,12 @@ using ServiceInsight.ServiceControl; using XmlViewer; - public class MessageBodyViewModel : RxScreen + public class MessageBodyViewModel : Screen, + IHandle, + IHandle { readonly IServiceControl serviceControl; - readonly IRxEventAggregator eventAggregator; - readonly IWorkNotifier workNotifier; + readonly IEventAggregator eventAggregator; readonly MessageSelectionContext selection; static Dictionary contentTypeMaps; @@ -38,11 +36,9 @@ public MessageBodyViewModel( JsonMessageViewModel jsonViewer, XmlMessageViewModel xmlViewer, IServiceControl serviceControl, - IRxEventAggregator eventAggregator, - IWorkNotifier workNotifier, + IEventAggregator eventAggregator, MessageSelectionContext selectionContext) { - this.workNotifier = workNotifier; this.serviceControl = serviceControl; this.eventAggregator = eventAggregator; selection = selectionContext; @@ -50,9 +46,6 @@ public MessageBodyViewModel( HexViewer = hexViewer; XmlViewer = xmlViewer; JsonViewer = jsonViewer; - - eventAggregator.GetEvent().Subscribe(Handle); - eventAggregator.GetEvent().Subscribe(Handle); } public HexContentViewModel HexViewer { get; } @@ -77,16 +70,13 @@ IEnumerable MessageDisplays } } - public bool JsonViewerVisible - => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Json) + public bool JsonViewerVisible => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Json) && PresentationHint == PresentationHint.Standard; - public bool XmlViewerVisible - => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Xml) + public bool XmlViewerVisible => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Xml) && PresentationHint == PresentationHint.Standard; - public bool HexViewerVisible - => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Json || ContentType == MessageContentType.Xml) + public bool HexViewerVisible => (ContentType == MessageContentType.NotSpecified || ContentType == MessageContentType.Json || ContentType == MessageContentType.Xml) && PresentationHint == PresentationHint.Standard; public bool NoContentHelpNotVisible => PresentationHint != PresentationHint.NoContent; @@ -136,12 +126,13 @@ void LoadMessageBody() return; } - using (workNotifier.NotifyOfWork("Loading message body...")) - { - serviceControl.LoadBody(selection.SelectedMessage); + eventAggregator.PublishOnUIThread(new WorkStarted("Loading message body...")); - RefreshChildren(); - } + serviceControl.LoadBody(selection.SelectedMessage); + + RefreshChildren(); + + eventAggregator.PublishOnUIThread(new WorkFinished()); } } } \ No newline at end of file diff --git a/src/ServiceInsight/MessageViewers/XmlViewer/IXmlMessageView.cs b/src/ServiceInsight/MessageViewers/XmlViewer/IXmlMessageView.cs new file mode 100644 index 00000000..7b0340a3 --- /dev/null +++ b/src/ServiceInsight/MessageViewers/XmlViewer/IXmlMessageView.cs @@ -0,0 +1,9 @@ +namespace ServiceInsight.MessageViewers.XmlViewer +{ + public interface IXmlMessageView + { + void Display(string message); + + void Clear(); + } +} \ No newline at end of file diff --git a/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageView.xaml.cs b/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageView.xaml.cs index 81ff53de..2e4336ba 100644 --- a/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageView.xaml.cs +++ b/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageView.xaml.cs @@ -1,11 +1,12 @@ namespace ServiceInsight.MessageViewers.XmlViewer { + using System; using System.Windows.Media; using System.Xml; using ICSharpCode.AvalonEdit.Folding; using ServiceInsight.ExtensionMethods; - public partial class XmlMessageView : IMessageViewer + public partial class XmlMessageView : IXmlMessageView { FoldingManager foldingManager; XmlFoldingStrategy foldingStrategy; @@ -49,4 +50,4 @@ public virtual void Clear() foldingStrategy.UpdateFoldings(foldingManager, document.Document); } } -} \ No newline at end of file +} diff --git a/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageViewModel.cs b/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageViewModel.cs index ed8c37f4..337d9c36 100644 --- a/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageViewModel.cs +++ b/src/ServiceInsight/MessageViewers/XmlViewer/XmlMessageViewModel.cs @@ -1,10 +1,54 @@ namespace ServiceInsight.MessageViewers.XmlViewer { - public class XmlMessageViewModel : BaseMessageScreen + using Caliburn.Micro; + using ServiceInsight.Models; + + public class XmlMessageViewModel : Screen, IDisplayMessageBody { - public XmlMessageViewModel() - : base("Xml") + IXmlMessageView messageView; + + protected override void OnActivate() { + base.OnActivate(); + DisplayName = "Xml"; + } + + protected override void OnViewAttached(object view, object context) + { + base.OnViewAttached(view, context); + messageView = (IXmlMessageView)view; + OnSelectedMessageChanged(); + } + + public MessageBody SelectedMessage { get; set; } + + public void OnSelectedMessageChanged() + { + if (messageView == null) + { + return; + } + + messageView.Clear(); + + if (SelectedMessage == null || SelectedMessage.Body == null) + { + return; + } + + messageView.Display(SelectedMessage.Body.Text); + } + + public void Display(StoredMessage selectedMessage) + { + if (SelectedMessage == selectedMessage) //Workaround, to force refresh the property. Should refactor to use the same approach as hex viewer. + { + OnSelectedMessageChanged(); + } + else + { + SelectedMessage = selectedMessage; + } } } } \ No newline at end of file diff --git a/src/ServiceInsight/Models/MessageInfo.cs b/src/ServiceInsight/Models/MessageInfo.cs index 7b2e3ae0..091a787c 100644 --- a/src/ServiceInsight/Models/MessageInfo.cs +++ b/src/ServiceInsight/Models/MessageInfo.cs @@ -1,11 +1,11 @@ namespace ServiceInsight.Models { using System; + using Caliburn.Micro; using Framework; - using Pirac; [Serializable] - public class MessageInfo : BindableObject + public class MessageInfo : PropertyChangedBase { public string Id { get; set; } diff --git a/src/ServiceInsight/Models/StoredMessage.cs b/src/ServiceInsight/Models/StoredMessage.cs index b721b406..e8277ce7 100644 --- a/src/ServiceInsight/Models/StoredMessage.cs +++ b/src/ServiceInsight/Models/StoredMessage.cs @@ -75,7 +75,7 @@ public string GetHeaderByKey(string key, string defaultValue = "") { //NOTE: Some keys start with NServiceBus, some don't var keyWithPrefix = "NServiceBus." + key; - var pair = Headers?.FirstOrDefault(x => x.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase) || + var pair = Headers.FirstOrDefault(x => x.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase) || x.Key.Equals(keyWithPrefix, StringComparison.InvariantCultureIgnoreCase)); return pair == null ? defaultValue : pair.Value; } diff --git a/src/ServiceInsight/Options/OptionsView.xaml.cs b/src/ServiceInsight/Options/OptionsView.xaml.cs index 93f68628..9e612546 100644 --- a/src/ServiceInsight/Options/OptionsView.xaml.cs +++ b/src/ServiceInsight/Options/OptionsView.xaml.cs @@ -1,10 +1,14 @@ namespace ServiceInsight.Options { - public partial class OptionsView + public interface IOptionsView + { + } + + public partial class OptionsView : IOptionsView { public OptionsView() { InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/ServiceInsight/Options/OptionsViewModel.cs b/src/ServiceInsight/Options/OptionsViewModel.cs index e7777f01..61167695 100644 --- a/src/ServiceInsight/Options/OptionsViewModel.cs +++ b/src/ServiceInsight/Options/OptionsViewModel.cs @@ -1,11 +1,11 @@ namespace ServiceInsight.Options { using System.ComponentModel; - using Framework.Rx; + using Caliburn.Micro; using ServiceInsight.Framework.Settings; using Settings; - public class OptionsViewModel : RxScreen + public class OptionsViewModel : Screen { public OptionsViewModel(ISettingsProvider settingsProvider) { @@ -18,8 +18,9 @@ public OptionsViewModel(ISettingsProvider settingsProvider) public bool IsModified { get; set; } - protected override void OnActivate(bool wasInitialized) + protected override void OnActivate() { + base.OnActivate(); LoadSettings(); IsModified = false; } diff --git a/src/ServiceInsight/Saga/SagaData.cs b/src/ServiceInsight/Saga/SagaData.cs index d67e4e3b..2afeba98 100644 --- a/src/ServiceInsight/Saga/SagaData.cs +++ b/src/ServiceInsight/Saga/SagaData.cs @@ -3,11 +3,10 @@ using System; using System.Collections.Generic; using System.Linq; - + using Caliburn.Micro; using Framework; - using Pirac; - public class SagaData : BindableObject + public class SagaData : PropertyChangedBase { public List Changes { get; set; } diff --git a/src/ServiceInsight/Saga/SagaMessage.cs b/src/ServiceInsight/Saga/SagaMessage.cs index d7d5e4ce..47c982e8 100644 --- a/src/ServiceInsight/Saga/SagaMessage.cs +++ b/src/ServiceInsight/Saga/SagaMessage.cs @@ -3,10 +3,9 @@ using System; using System.Collections.Generic; using System.Linq; - + using Caliburn.Micro; using Framework; using Models; - using Pirac; using ServiceControl; public class SagaMessageDataItem @@ -16,7 +15,7 @@ public class SagaMessageDataItem public string Value { get; set; } } - public class SagaMessage : BindableObject + public class SagaMessage : PropertyChangedBase { public string MessageId { get; set; } diff --git a/src/ServiceInsight/Saga/SagaUpdate.cs b/src/ServiceInsight/Saga/SagaUpdate.cs index 038c1474..469d3223 100644 --- a/src/ServiceInsight/Saga/SagaUpdate.cs +++ b/src/ServiceInsight/Saga/SagaUpdate.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; using System.Linq; - using Pirac; + using Caliburn.Micro; - public class SagaUpdate : BindableObject + public class SagaUpdate : PropertyChangedBase { public DateTime FinishTime { get; set; } diff --git a/src/ServiceInsight/Saga/SagaUpdatedValue.cs b/src/ServiceInsight/Saga/SagaUpdatedValue.cs index b44d287d..f688a968 100644 --- a/src/ServiceInsight/Saga/SagaUpdatedValue.cs +++ b/src/ServiceInsight/Saga/SagaUpdatedValue.cs @@ -1,10 +1,10 @@ namespace ServiceInsight.Saga { using System.Windows.Input; + using Caliburn.Micro; + using ExtensionMethods; - using Pirac; - - public class SagaUpdatedValue : BindableObject + public class SagaUpdatedValue : PropertyChangedBase { public const byte MaxValueLength = 30; @@ -13,7 +13,7 @@ public SagaUpdatedValue(string sagaName, string propertyName, string propertyVal SagaName = sagaName; Name = propertyName; NewValue = propertyValue; - ShowEntireContentCommand = Command.Create(ShowEntireContent); + ShowEntireContentCommand = this.CreateCommand(ShowEntireContent); } public string SagaName { get; } diff --git a/src/ServiceInsight/Saga/SagaWindowView.xaml b/src/ServiceInsight/Saga/SagaWindowView.xaml index 5234cd7c..3cb52695 100644 --- a/src/ServiceInsight/Saga/SagaWindowView.xaml +++ b/src/ServiceInsight/Saga/SagaWindowView.xaml @@ -33,11 +33,10 @@ - + @@ -109,6 +108,7 @@ + @@ -180,11 +180,13 @@ Style="{StaticResource BlankButtonStyle}" ToolTip="Copy nuget command to clipboard"> + + + \ No newline at end of file diff --git a/src/ServiceInsight/Saga/SagaWindowView.xaml.cs b/src/ServiceInsight/Saga/SagaWindowView.xaml.cs index f9dc2d75..bdbb4b01 100644 --- a/src/ServiceInsight/Saga/SagaWindowView.xaml.cs +++ b/src/ServiceInsight/Saga/SagaWindowView.xaml.cs @@ -5,7 +5,7 @@ using System.Windows.Documents; using System.Windows.Media; - public partial class SagaWindowView + public partial class SagaWindowView : ISagaWindowView { public SagaWindowView() { @@ -40,4 +40,8 @@ static void ScrollIntoView(ItemsControl steps, int i) } } } + + public interface ISagaWindowView + { + } } \ No newline at end of file diff --git a/src/ServiceInsight/Saga/SagaWindowViewModel.cs b/src/ServiceInsight/Saga/SagaWindowViewModel.cs index ed38b7cc..50eaf72b 100644 --- a/src/ServiceInsight/Saga/SagaWindowViewModel.cs +++ b/src/ServiceInsight/Saga/SagaWindowViewModel.cs @@ -4,47 +4,36 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Input; + using Caliburn.Micro; + using ExtensionMethods; using Framework; using Framework.Events; - using Framework.Rx; using MessageList; using Models; - using Pirac; using ServiceControl; - public class SagaWindowViewModel : RxScreen + public class SagaWindowViewModel : Screen, IHandle { SagaData data; StoredMessage currentMessage; string selectedMessageId; - IRxEventAggregator eventAggregator; - IWorkNotifier workNotifier; + IEventAggregator eventAggregator; IServiceControl serviceControl; readonly MessageSelectionContext selection; - public SagaWindowViewModel( - IRxEventAggregator eventAggregator, - IWorkNotifier workNotifier, - IServiceControl serviceControl, - IClipboard clipboard, - MessageSelectionContext selectionContext) + public SagaWindowViewModel(IEventAggregator eventAggregator, IServiceControl serviceControl, IClipboard clipboard, MessageSelectionContext selectionContext) { - this.workNotifier = workNotifier; this.eventAggregator = eventAggregator; this.serviceControl = serviceControl; selection = selectionContext; ShowSagaNotFoundWarning = false; - CopyCommand = Command.Create(() => clipboard.CopyTo(InstallScriptText)); - ShowFlowComamnd = Command.Create(() => eventAggregator.Publish(SwitchToFlowWindow.Instance)); - eventAggregator.GetEvent().Subscribe(Handle); + CopyCommand = this.CreateCommand(arg => clipboard.CopyTo(InstallScriptText)); } public string InstallScriptText { get; set; } public ICommand CopyCommand { get; } - public ICommand ShowFlowComamnd { get; } - public void OnShowMessageDataChanged() { if (Data == null || Data.Changes == null) @@ -71,7 +60,7 @@ void RefreshShowData() message.ShowData = ShowMessageData; } - NotifyOfPropertyChange(nameof(Data)); + NotifyOfPropertyChange(() => Data); } void RefreshMessageProperties() @@ -81,10 +70,10 @@ void RefreshMessageProperties() message.RefreshData(serviceControl); } - NotifyOfPropertyChange(nameof(Data)); + NotifyOfPropertyChange(() => Data); } - void Handle(SelectedMessageChanged @event) + public void Handle(SelectedMessageChanged @event) { var message = selection.SelectedMessage; if (message == null) @@ -132,8 +121,10 @@ void RefreshSaga(StoredMessage message) void RefreshSaga(SagaInfo originatingSaga) { - using (workNotifier.NotifyOfWork("Loading message body...")) + try { + eventAggregator.PublishOnUIThread(new WorkStarted("Loading message body...")); + var previousSagaId = Guid.Empty; if (Data == null || Data.SagaId != originatingSaga.SagaId) @@ -181,6 +172,10 @@ void RefreshSaga(SagaInfo originatingSaga) RefreshMessageProperties(); } } + finally + { + eventAggregator.PublishOnUIThread(new WorkFinished()); + } } static void ProcessDataValues(IEnumerable list) @@ -226,6 +221,11 @@ private set public bool ShowMessageData { get; set; } + public void ShowFlow() + { + eventAggregator.PublishOnUIThread(SwitchToFlowWindow.Instance); + } + public void RefreshSaga() { RefreshSaga(currentMessage); diff --git a/src/ServiceInsight/Search/SearchBarView.xaml b/src/ServiceInsight/Search/SearchBarView.xaml index 1e881c1d..56df609d 100644 --- a/src/ServiceInsight/Search/SearchBarView.xaml +++ b/src/ServiceInsight/Search/SearchBarView.xaml @@ -7,10 +7,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:search="clr-namespace:ServiceInsight.Search" x:Name="searchbar" - d:DataContext="{d:DesignInstance search:SearchBarViewModel}" d:DesignHeight="35" d:DesignWidth="600" - mc:Ignorable="d"> + mc:Ignorable="d" d:DataContext="{d:DesignInstance search:SearchBarViewModel}"> @@ -22,10 +21,10 @@