public EquivalenceTestCase( MethodPair methods, ParameterListPair parameters, KnownNamespaces knownNamespaces, OptionsResolver optionsResolver, UniqueIdentifier uniqueIdentifier) { _methods = methods; _parameters = parameters; _uniqueIdentifier = uniqueIdentifier; _knownNamespaces = knownNamespaces; _optionsResolver = optionsResolver; }
public NullParameterTestCase( MethodInfo method, ParameterInfo parameter, ParameterList parameters, KnownNamespaces knownNamespaces, OptionsResolver optionsResolver, UniqueIdentifier uniqueIdentifier) { Method = method; Parameter = parameter; _parameters = parameters; _uniqueIdentifier = uniqueIdentifier; _knownNamespaces = knownNamespaces; _optionsResolver = optionsResolver; }
public NullParameterTestCaseGenerator(KnownNamespaces knownNamespaces, OptionsResolver optionsResolver) { if (knownNamespaces is null) { throw new ArgumentNullException(nameof(knownNamespaces)); } if (optionsResolver is null) { throw new ArgumentNullException(nameof(optionsResolver)); } _knownNamespaces = knownNamespaces; _optionsResolver = optionsResolver; }
public LambdaParameterBuilder( KnownNamespaces knownNamespaces, Type sourceType, Type delegateType, string?prefix, bool isExpression, string paramName, string operationName, UniqueIdentifierBuilder?identifierBuilder) { if (knownNamespaces is null) { throw new ArgumentNullException(nameof(knownNamespaces)); } _knownNamespaces = knownNamespaces; SourceType = sourceType; DelegateType = delegateType; Prefix = prefix; IsExpression = isExpression; ParamName = paramName; OperationName = operationName; IdentifierBuilder = identifierBuilder; var method = delegateType.GetMethod("Invoke") !; var returnType = method.ReturnType; var parameters = method.GetParameters(); _isAsync = true; if (!TypeHelper.IsValueTaskType(returnType, out var resultType)) { resultType = returnType; _isAsync = false; } _resultType = resultType; var parameterTypes = parameters.Select(p => p.ParameterType).ToArray(); var parameterTypesWithoutCancellation = parameterTypes; _hasCancellation = false; if (_isAsync && parameterTypes.Length > 0 && parameterTypes[^ 1] == typeof(CancellationToken)) { parameterTypesWithoutCancellation = parameterTypes[..^ 1];
protected ParameterEvaluatorBase( KnownNamespaces knownNamespaces, KnownCollectionTypes knownCollectionTypes) { if (knownNamespaces is null) { throw new ArgumentNullException(nameof(knownNamespaces)); } if (knownCollectionTypes is null) { throw new ArgumentNullException(nameof(knownCollectionTypes)); } KnownNamespaces = knownNamespaces; KnownCollectionTypes = knownCollectionTypes; }
public ParametersBuilder(IEnumerable <IParameterEvaluator> evaluators, KnownNamespaces knownNamespaces) { if (evaluators is null) { throw new ArgumentNullException(nameof(evaluators)); } if (knownNamespaces is null) { throw new ArgumentNullException(nameof(knownNamespaces)); } if (evaluators.Any(p => p is null)) { ThrowHelper.ThrowCollectionMustNotContainNullEntries(nameof(evaluators)); } _evaluators = evaluators as ImmutableList <IParameterEvaluator> ?? evaluators.ToImmutableList(); _knownNamespaces = knownNamespaces; }
public LambdaParameter( KnownNamespaces knownNamespaces, string name, Type resultType, Type delegateType, bool isAsync, bool hasCancellation, bool hasIndex, bool isExpression, Action <StringBuilder> formatResult, IReadOnlyList <string>?parameters = null, bool declaresVariables = true) : base(name, declaresVariables) { if (knownNamespaces is null) { throw new ArgumentNullException(nameof(knownNamespaces)); } if (resultType is null) { throw new ArgumentNullException(nameof(resultType)); } if (delegateType is null) { throw new ArgumentNullException(nameof(delegateType)); } _knownNamespaces = knownNamespaces; ResultType = resultType; DelegateType = delegateType; IsAsync = isAsync; HasCancellation = hasCancellation; HasIndex = hasIndex; IsExpression = isExpression; _formatResult = formatResult; _parameters = parameters ?? Array.Empty <string>(); }
public EqualityComparerParameterEvaluator( KnownNamespaces knownNamespaces, KnownCollectionTypes knownCollectionTypes) : base(knownNamespaces, knownCollectionTypes) { }
public LambdaParameterEvaluator( KnownNamespaces knownNamespaces, KnownCollectionTypes knownCollectionTypes) : base(knownNamespaces, knownCollectionTypes) { }
// ======================================================================== // Methods #region === Methods /// <summary> /// Visit a <see cref="NRAssembly"/>. /// </summary> /// <param name="nrAssembly">The <see cref="NRAssembly"/> to visit.</param> public void Visit(NRAssembly nrAssembly) { NRAssembly = nrAssembly; if (KnownNamespaces != null) { foreach (string knownNamespace in KnownNamespaces.Where(s => !string.IsNullOrWhiteSpace(s))) { OutputLine("using " + knownNamespace + ";"); } if (KnownNamespaces.Length > 0) { OutputLine(""); } } IEnumerable <string> namespaces = (from type in nrAssembly.Types select type.Namespace).Distinct(); foreach (string ns in namespaces) { bool nsPresent = !string.IsNullOrWhiteSpace(ns); if (nsPresent) { OutputLine("namespace " + ns); OutputLine("{"); indent++; } foreach (NRClass nrClass in nrAssembly.Classes) { if (nrClass.Namespace == ns) { nrClass.Accept(this); } } foreach (NRStruct nrStruct in nrAssembly.Structs) { if (nrStruct.Namespace == ns) { nrStruct.Accept(this); } } foreach (NRInterface nrInterface in nrAssembly.Interfaces) { if (nrInterface.Namespace == ns) { nrInterface.Accept(this); } } foreach (NRDelegate nrDelegate in nrAssembly.Delegates) { if (nrDelegate.Namespace == ns) { nrDelegate.Accept(this); } } foreach (NREnum nrEnum in nrAssembly.Enums) { if (nrEnum.Namespace == ns) { nrEnum.Accept(this); } } if (nsPresent) { indent--; OutputLine("}"); OutputEmptyLineAfterType(); } } }
public IntegratedNumericTypeParameterEvaluator( KnownNamespaces knownNamespaces, KnownCollectionTypes knownCollectionTypes) : base(knownNamespaces, knownCollectionTypes) { }
public QueryableParameterEvaluator( KnownNamespaces knownNamespaceProvider, KnownCollectionTypes knownCollectionTypes) : base(knownNamespaceProvider, knownCollectionTypes) { }