public void QueueEventsViewModel_Queues()
        {
            Mock <IServer> mockServer           = SetupForTriggerQueueView(null);
            var            queueEventsViewModel = new QueueEventsViewModel(mockServer.Object);

            Assert.IsNotNull(queueEventsViewModel.Queues);
            Assert.AreEqual(2, queueEventsViewModel.Queues.Count);
            Assert.IsNull(queueEventsViewModel.SelectedQueue);

            var queue1 = new TriggerQueueViewForTesting(mockServer.Object);
            var queue2 = new TriggerQueueViewForTesting(mockServer.Object);

            queueEventsViewModel.Queues = new ObservableCollection <TriggerQueueView>
            {
                queue1,
                queue2
            };

            queueEventsViewModel.SelectedQueue = queue2;

            Assert.IsNotNull(queueEventsViewModel.Queues);
            Assert.AreEqual(2, queueEventsViewModel.Queues.Count);

            Assert.IsNotNull(queueEventsViewModel.SelectedQueue);
            Assert.AreEqual(queue2, queueEventsViewModel.SelectedQueue);
        }
        public void QueueEventsViewModel_QueueEvents_ViewQueueStats()
        {
            Uri uri = new Uri("https://www.rabbitmq.com/blog/tag/statistics/");

            var mockServer           = SetupForTriggerQueueView(null);
            var mockExternalExecutor = new Mock <IExternalProcessExecutor>();

            var mockResourcePickerDialog = new Mock <IResourcePickerDialog>();
            var queueEventsViewModel     = new QueueEventsViewModel(mockServer.Object, mockExternalExecutor.Object, mockResourcePickerDialog.Object);

            queueEventsViewModel.QueueStatsCommand.Execute(null);

            mockExternalExecutor.Verify(externalProcessExecutor => externalProcessExecutor.OpenInBrowser(uri), Times.Once);
        }
        public void QueueEventsViewModel_ConnectionError_SetAndClearError_ValidErrorSetAndClear()
        {
            //------------Setup for test--------------------------
            Mock <IServer> mockServer           = SetupForTriggerQueueView(null);
            var            queueEventsViewModel = new QueueEventsViewModel(mockServer.Object);
            var            triggerQueueView     = new TriggerQueueViewForTesting(mockServer.Object);

            queueEventsViewModel.SelectedQueue = triggerQueueView;
            //------------Execute Test---------------------------
            queueEventsViewModel.SetConnectionError();
            //------------Assert Results-------------------------
            Assert.AreEqual(Warewolf.Studio.Resources.Languages.Core.QueueConnectionError, queueEventsViewModel.ConnectionError);
            Assert.IsTrue(queueEventsViewModel.HasConnectionError);

            queueEventsViewModel.ClearConnectionError();

            Assert.AreEqual("", queueEventsViewModel.ConnectionError);
            Assert.IsFalse(queueEventsViewModel.HasConnectionError);
        }