示例#1
0
        public void ensureGetRequiredInputsReturnsEmptyList()
        {
            Console.WriteLine("ensureGetRequiredInputsReturnsNull");
            Algorithm alg = new AlgorithmFactory().createAlgorithm(RestrictionAlgorithm.SAME_MATERIAL_AND_FINISH_ALGORITHM);

            Assert.Empty(alg.getRequiredInputs());
        }
示例#2
0
        /// <summary>
        /// Returns an instance of GetAllInputsModelView representing the Algorithm's required inputs.
        /// </summary>
        /// <param name="restrictionAlgorithm">RestrictionAlgorithm that matches the corresponding Algorithm.</param>
        /// <returns>GetAllInputsModelView representing the Algorithm's required inputs. </returns>
        /// <exception cref="ResourceNotFoundException">Thrown when the Algorithm has no required inputs.</exception>
        public GetAllInputsModelView getAlgorithmRequiredInputs(RestrictionAlgorithm restrictionAlgorithm)
        {
            Algorithm algorithm = new AlgorithmFactory().createAlgorithm(restrictionAlgorithm);

            List <Input> requiredInputs = algorithm.getRequiredInputs();

            if (!requiredInputs.Any())
            {
                throw new ResourceNotFoundException(NO_REQUIRED_INPUTS);
            }

            return(InputModelViewService.fromCollection(requiredInputs));
        }