コード例 #1
0
        public void Should_Set_Description()
        {
            // Given, When
            var result = new StartedListeningEvent(1, "Description", "Name");

            // Then
            Assert.Equal("Description", result.Description);
        }
コード例 #2
0
        public void Should_Set_Thread_ID()
        {
            // Given, When
            var result = new StartedListeningEvent(1, "Description", "Name");

            // Then
            Assert.Equal(1, result.ThreadId);
        }
コード例 #3
0
        public void Handle(StartedListeningEvent message)
        {
            Debug.Assert(message.ThreadId > -1, "Invalid thread ID recieved.");
            _logger.Information("Received StartedListeningEvent (#{0})", message.ThreadId);

            // Create the view model.
            var viewModel = _streamFactory.Create(message.ThreadId);

            viewModel.DisplayName = message.TabName;

            // Add a view model mapping to be able to do thread lookup.
            // The reason for this is that we don't want to let the view model
            // handle it's own associated thread ID.
            _mappings.Add(new ViewModelMapping(viewModel, message.ThreadId));

            // Activate the new stream listener.
            ActivateItem(viewModel);

            NotifyOfPropertyChange(() => CanPause);
            NotifyOfPropertyChange(() => CanResume);
            NotifyOfPropertyChange(() => CanOpenListener);
            NotifyOfPropertyChange(() => CanCloseListener);
            NotifyOfPropertyChange(() => HasListeners);
        }