Exemplo n.º 1
0
        public void TestInitialize()
        {
            queueManager      = Substitute.For <IQueueManagerAsync>();
            view              = Substitute.For <IExplorerView>();
            eventAggregator   = Substitute.For <IEventAggregator>();
            windowManagerEx   = Substitute.For <IWindowManagerEx>();
            networkOperations = Substitute.For <INetworkOperations>();
            explorer          = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            queue    = new Queue("TestQueue");
            subQueue = new Queue("TestQueue.Subscriptions");

            IList <Queue> queues = new List <Queue> {
                queue, subQueue
            };

            queueManager.GetQueues(Arg.Any <string>()).Returns(Task.Run(() => queues));
            queueManager.GetQueues().Returns(Task.Run(() => queues));
            queueManager.GetMessageCount(Arg.Any <Queue>()).Returns(Task.Run(() => queues.Count));
            queueManager.IsMsmqInstalled(Arg.Any <string>()).Returns(Task.Run(() => true));

            AsyncHelper.Run(() => explorer.AttachView(view, null));
            AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName));

            queueNode = explorer.MachineRoot.Children.OfType <QueueExplorerItem>().First();
        }
Exemplo n.º 2
0
        public void should_display_connected_server_when_loading_queue_from_the_connected_server()
        {
            var           anotherQueue = new Queue("SecondQueue");
            IList <Queue> queues       = new List <Queue> {
                queue, anotherQueue
            };

            queueManager.GetQueues(Arg.Any <string>()).Returns(Task.FromResult(queues));

            AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName));
            AsyncHelper.Run(() => explorer.RefreshData());

            explorer.Items[0].ShouldBeTypeOf <QueueServerExplorerItem>();
            explorer.Items.Count.ShouldBe(1);
            explorer.MachineRoot.Children.Count.ShouldBe(2);
        }