示例#1
0
        public PerfTester(
            Type testerType,
            PerfTesterAttribute attr
            )
        {
            if (testerType==null)
                throw new ArgumentNullException("testerType");
            if (attr==null)
                throw new ArgumentNullException("attr");

            this.testerType = testerType;
            this.testedType = attr.TestedType;
            this.testCount = attr.TestCount;
            this.description = attr.Description;
            this.featureDescription = attr.FeatureDescription;

            // get constructor
            this.constructor = this.testerType.GetConstructor(Type.EmptyTypes);

            // get run descriptor
            this.runDescriptor = TypeHelper.GetAttributedMethod(this.testerType,typeof(PerfRunDescriptorAttribute));
            if (this.runDescriptor!=null)
                TypeHelper.CheckSignature(this.runDescriptor,typeof(double),typeof(int));

            // get set up
            this.setUp = TypeHelper.GetAttributedMethod(this.testerType,typeof(PerfSetUpAttribute));
            if (this.setUp!=null)
                TypeHelper.CheckSignature(this.setUp,typeof(void),typeof(int),this.testedType);

            // get tear down
            this.tearDown = TypeHelper.GetAttributedMethod(this.testerType,typeof(PerfTearDownAttribute));
            if (this.tearDown!=null)
                TypeHelper.CheckSignature(this.tearDown,typeof(void),this.testedType);

            // get test method
            this.methods = new MethodInfoCollection();
            foreach(MethodInfo mi in TypeHelper.GetAttributedMethods(this.testerType,typeof(PerfTestAttribute)))
            {
                TypeHelper.CheckSignature(mi, typeof(void), this.testedType);
                this.methods.Add(mi);
            }

            this.testedTypes = new TypeCollection();
            this.timer = new TimeMonitor();
            this.memorizer = new MemoryMonitor();
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the MethodInfoCollection class, containing elements
 /// copied from another instance of MethodInfoCollection
 /// </summary>
 /// <param name="items">
 /// The MethodInfoCollection whose elements are to be added to the new MethodInfoCollection.
 /// </param>
 public MethodInfoCollection(MethodInfoCollection items)
 {
     this.AddRange(items);
 }
示例#3
0
 /// <summary>
 /// Adds the elements of another MethodInfoCollection to the end of this MethodInfoCollection.
 /// </summary>
 /// <param name="items">
 /// The MethodInfoCollection whose elements are to be added to the end of this MethodInfoCollection.
 /// </param>
 public virtual void AddRange(MethodInfoCollection items)
 {
     foreach (MethodInfo item in items)
     {
         this.List.Add(item);
     }
 }
示例#4
0
 public Enumerator(MethodInfoCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }