Example #1
0
        public void HandleModuleClases_InvalidClass_ReturnsNull()
        {
            // Act
            var result = _target.HandleModuleClases(typeof(DummyClass), "any");

            // Assert
            result.Should().BeNull();
        }
        /// <summary>
        /// Determines type of module and redirects to method to handle that module
        /// </summary>
        /// <param name="type">Type of module</param>
        /// <param name="userInput">User input</param>
        /// <returns>New object with user values</returns>
        public object HandleSpecificModule(Type type, string userInput)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (userInput == null)
            {
                throw new ArgumentNullException(nameof(userInput));
            }

            if (type.IsEnum)
            {
                return(userInput.ToEnum(type));
            }

            if (type.IsValueType)
            {
                return(HandleStructs(type, userInput));
            }

            if (type.IsClass)
            {
                return(_moduleClassHandler.HandleModuleClases(type, userInput));
            }

            return(null);
        }