예제 #1
0
        public void DebugOutputDisplayedExpectsDisplayedToCorrectViewModel()
        {
            ImportService.CurrentContext = _importServiceContext;

            AddAdditionalContext();
            var msg = new DebugWriterWriteMessage
                          (DebugStateFactory.Create(_firstResource.Object.ServerID, _firstResource.Object.ID, StateType.Message,
                                                    "Test1"));
            var msg2 = new DebugWriterWriteMessage
                           (DebugStateFactory.Create(_secondResource.Object.ServerID, _secondResource.Object.ID, StateType.Message,
                                                     "Test2"));

            _mainViewModel.Handle(msg);
            _mainViewModel.Handle(msg2);

            var firstctx  = _mainViewModel.FindWorkSurfaceContextViewModel(_firstResource.Object);
            var secondctx = _mainViewModel.FindWorkSurfaceContextViewModel(_secondResource.Object);

            var firstDebug = firstctx.DebugOutputViewModel;
            var firstItem  = firstDebug.RootItems.First() as DebugStringTreeViewItemViewModel;

            Assert.IsTrue(firstDebug.RootItems.Count == 1 && firstItem.Content == "Test1");

            var secondDebug = secondctx.DebugOutputViewModel;
            var secondItem  = secondDebug.RootItems.First() as DebugStringTreeViewItemViewModel;

            Assert.IsTrue(secondDebug.RootItems.Count == 1 && secondItem.Content == "Test2");
        }
 void DispatchServerDebugMessage(ExecuteMessage message, IContextualResourceModel resource)
 {
     if (message != null && message.Message != null)
     {
         var debugstate = DebugStateFactory.Create(message.Message.ToString(), resource);
         if (_debugOutputViewModel != null)
         {
             debugstate.SessionID = _debugOutputViewModel.SessionID;
             _debugOutputViewModel.Append(debugstate);
         }
     }
 }