Ejemplo n.º 1
0
        public MvcActionTester ParameterTypeIs(string paramName, string typescriptName)
        {
            MvcActionParameter parameter = _method.Parameters.Where(p => p.Name == paramName).First();

            Assert.AreEqual(typescriptName, parameter.Type.FormatType(_typeFormatter));
            return(this);
        }
        private string FormatMethodParameter(MvcActionParameter oneParam)
        {
            string paramTypes = string.Join(" | ", oneParam.Types.Select(t =>
            {
                string formattedType = t.FormatType(_formatter);
                if (oneParam.BindingType == ActionParameterSourceType.Query && t.IsComplexType())
                {
                    formattedType = $"Partial<{formattedType}>";
                }
                return(formattedType);
            }));

            return($"{oneParam.Name}{ (oneParam.IsOptional ? "?" : "") }: {paramTypes}");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Evaluates the parameter for whether it should be included
 /// </summary>
 /// <param name="actionParameter">The parameter</param>
 /// <returns>True if it should be inclued</returns>
 public override bool Evaluate(MvcActionParameter actionParameter)
 {
     return(actionParameter.Attributes.Any(attr => _attributeFilter.Matches(attr.AttributeType)));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Evaluates the parameter for whether it should be included
 /// </summary>
 /// <param name="actionParameter">The parameter</param>
 /// <returns>True if it should be inclued</returns>
 public abstract bool Evaluate(MvcActionParameter actionParameter);