コード例 #1
0
        private void SendMessage()
        {
            var changedMessage = new ExceptionThrownChangedMessage
                                 {
                                     Text = LastError
                                 };

            m_Bus.PublishAsync(changedMessage);
        }
コード例 #2
0
        public void CanExecuteClearErrorCommand_ReturnsTrue_ForExceptionThrownIsNotEmpty()
        {
            // Arrange
            var message = new ExceptionThrownChangedMessage
                          {
                              Text = "Text"
                          };

            m_Sut.ExceptionThrownChangedHandler(message);

            // Act
            // Assert
            Assert.True(m_Sut.CanExecuteClearErrorCommand());
        }
コード例 #3
0
        public void ExceptionThrownChangedHandler_RaisesEventExceptionThrown_WhenCalled()
        {
            // Arrange
            var changed = new TestNotifyPropertyChanged(m_Sut,
                                                        "ExceptionThrown");
            var message = new ExceptionThrownChangedMessage
                          {
                              Text = "Text"
                          };

            // Act
            m_Sut.ExceptionThrownChangedHandler(message);

            // Assert
            Assert.True(changed.IsExpectedNotified);
        }
コード例 #4
0
        public void IsClearErrorEnabled_ReturnsTrue_ForExceptionThrownIsNotEmpty()
        {
            // Arrange
            var message = new ExceptionThrownChangedMessage
                          {
                              Text = "Text"
                          };

            m_Sut.ExceptionThrownChangedHandler(message);

            // Act
            // Assert
            Assert.True(m_Sut.IsClearErrorEnabled);
        }
コード例 #5
0
        public void ExceptionThrownChangedHandler_SetsStatus_WhenCalled()
        {
            // Arrange
            const string expected = "Text";
            var message = new ExceptionThrownChangedMessage
                          {
                              Text = expected
                          };

            // Act
            m_Sut.ExceptionThrownChangedHandler(message);

            // Assert
            Assert.AreEqual(expected,
                            m_Sut.ExceptionThrown);
        }
コード例 #6
0
        public void ExceptionThrownChangedHandler_SetsExceptionThrownToEmpty_WhenTextIsNull()
        {
            // Arrange
            var message = new ExceptionThrownChangedMessage
                          {
                              Text = null
                          };

            // Act
            m_Sut.ExceptionThrownChangedHandler(message);

            // Assert
            Assert.AreEqual(string.Empty,
                            m_Sut.ExceptionThrown);
        }
コード例 #7
0
        private void UpdateAndNotify(ExceptionThrownChangedMessage message)
        {
            ExceptionThrown = message.Text ?? string.Empty;

            NotifyPropertyChanged("ExceptionThrown");
            NotifyPropertyChanged("IsClearErrorEnabled");

            m_CommandManager.InvalidateRequerySuggested();
        }
コード例 #8
0
 internal void ExceptionThrownChangedHandler(ExceptionThrownChangedMessage message)
 {
     m_Dispatcher.BeginInvoke(() => UpdateAndNotify(message));
 }