Exemple #1
0
        public void ParameterTable_Add_ArgumentChecking()
        {
            var pt = new ParameterTable();

            Assert.ThrowsException <ArgumentNullException>(() => pt.Add(default(LambdaExpression)));
            Assert.ThrowsException <ArgumentNullException>(() => pt.Add(default(ParameterInfo)));
            Assert.ThrowsException <ArgumentNullException>(() => pt.Add(default(ParameterTable)));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IndexerType"/> class.
        /// </summary>
        /// <param name="baseTypeName">The type name of the resolved base type.</param>
        /// <param name="baseType">The type of the resolved base type.</param>
        /// <param name="entityTypeName">The type name of the resolved result type.</param>
        /// <param name="entityType">The type of the resolved result type.</param>
        /// <param name="indexerKind">Type of indexer.</param>
        /// <param name="indexParameterList">The list of parameters.</param>
        /// <param name="parameterEnd">The indexer parameter end type.</param>
        /// <param name="getRequireList">The list of require assertions for the getter.</param>
        /// <param name="getEnsureList">The list of ensure assertions for the getter.</param>
        /// <param name="getExceptionIdentifierList">The list of known exceptions thrown for the getter.</param>
        /// <param name="setRequireList">The list of require assertions for the setter.</param>
        /// <param name="setEnsureList">The list of ensure assertions for the setter.</param>
        /// <param name="setExceptionIdentifierList">The list of known exceptions thrown for the setter.</param>
        public IndexerType(ITypeName baseTypeName, IClassType baseType, ITypeName entityTypeName, ICompiledType entityType, BaseNode.UtilityType indexerKind, IList <IEntityDeclaration> indexParameterList, BaseNode.ParameterEndStatus parameterEnd, IList <IAssertion> getRequireList, IList <IAssertion> getEnsureList, IList <IIdentifier> getExceptionIdentifierList, IList <IAssertion> setRequireList, IList <IAssertion> setEnsureList, IList <IIdentifier> setExceptionIdentifierList)
            : this()
        {
            BaseType     = baseType;
            EntityType   = null;
            ParameterEnd = parameterEnd;
            IndexerKind  = indexerKind;

            ResolvedBaseTypeName.Item   = baseTypeName;
            ResolvedBaseType.Item       = baseType;
            ResolvedEntityTypeName.Item = entityTypeName;
            ResolvedEntityType.Item     = entityType;
            IndexParameterList          = indexParameterList;
            GetRequireList             = getRequireList;
            GetEnsureList              = getEnsureList;
            GetExceptionIdentifierList = getExceptionIdentifierList;
            SetRequireList             = setRequireList;
            SetEnsureList              = setEnsureList;
            SetExceptionIdentifierList = setExceptionIdentifierList;

            foreach (IEntityDeclaration Item in indexParameterList)
            {
                IName  ParameterName = (IName)Item.EntityName;
                string ValidText     = ParameterName.ValidText.Item;
                IScopeAttributeFeature ParameterFeature = Item.ValidEntity.Item;
                ParameterTable.Add(new Parameter(ValidText, ParameterFeature));
            }
            ParameterTable.Seal();
        }
Exemple #3
0
        public void ParameterTable_Add_Action7()
        {
            var pt = new ParameterTable();

            pt.Add((int arg3, int arg1, int arg2, int arg4, int arg5, int arg6, int arg7) => Methods.Action7(arg1, arg2, arg3, arg4, arg5, arg6, arg7));

            var m = typeof(Methods).GetMethod(nameof(Methods.Action7));

            Assert.IsTrue(pt.Contains(m.GetParameters()[2]));
        }
Exemple #4
0
        public void ParameterTable_Add_Func16()
        {
            var pt = new ParameterTable();

            pt.Add((int arg13, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11, int arg12, int arg14, int arg15, int arg16) => Methods.Func16(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16));

            var m = typeof(Methods).GetMethod(nameof(Methods.Func16));

            Assert.IsTrue(pt.Contains(m.GetParameters()[12]));
        }
Exemple #5
0
        public void ParameterTable_Add_Action2()
        {
            var pt = new ParameterTable();

            pt.Add((int arg2, int arg1) => Methods.Action2(arg1, arg2));

            var m = typeof(Methods).GetMethod(nameof(Methods.Action2));

            Assert.IsTrue(pt.Contains(m.GetParameters()[1]));
        }
Exemple #6
0
        public void ParameterTable_Add_Func8()
        {
            var pt = new ParameterTable();

            pt.Add((int arg7, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg8) => Methods.Func8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8));

            var m = typeof(Methods).GetMethod(nameof(Methods.Func8));

            Assert.IsTrue(pt.Contains(m.GetParameters()[6]));
        }
Exemple #7
0
        public void ParameterTable_Add_Func4()
        {
            var pt = new ParameterTable();

            pt.Add((int arg1, int arg2, int arg3, int arg4) => Methods.Func4(arg1, arg2, arg3, arg4));

            var m = typeof(Methods).GetMethod(nameof(Methods.Func4));

            Assert.IsTrue(pt.Contains(m.GetParameters()[0]));
        }