Esempio n. 1
0
        /// <summary>
        /// Initializes a new <see cref="BaseResult" /> class.
        /// </summary>
        /// <param name="message">The result message.</param>
        /// <param name="success">Whether the operation was successful.</param>
        protected BaseResult(string message, bool success = true, Object viewModel = null)
        {
            Message   = message;
            IsSuccess = success;

            if (viewModel != null && ViewModelAttribute.IsViewModel(viewModel))
            {
                ViewModel = viewModel;
            }
        }
Esempio n. 2
0
        public void IsViewModel_InvalidViewModel_ReturnFalse()
        {
            // Arrange
            var notViewModel = new Character(1, "C");

            // Act
            bool result = ViewModelAttribute.IsViewModel(notViewModel);

            // Assert
            Assert.False(result);
        }
Esempio n. 3
0
        public void IsViewModel_NullViewModel_ReturnFalse()
        {
            // Arrange
            object nullViewModel = null;

            // Act
            bool result = ViewModelAttribute.IsViewModel(nullViewModel);

            // Assert
            Assert.False(result);
        }
Esempio n. 4
0
        public void IsViewModel_ValidViewModel_ReturnTrue()
        {
            // Arrange
            var viewModel = new ShowCharacterViewModel();

            // Act
            bool result = ViewModelAttribute.IsViewModel(viewModel);

            // Assert
            Assert.True(result);
        }