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_not_throw_an_exception_when_system_queues_are_orphaned()
        {
            IList<Queue> unorderedQueueList = new List<Queue>(new[] { new Queue("myqueue.subscriptions") });
            queueManager = Substitute.For<IQueueManagerAsync>();
            queueManager.GetQueues().ReturnsForAnyArgs(Task.FromResult(unorderedQueueList));
            explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            Should.NotThrow(() => explorer.RefreshData());
        }