Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Form1"/> class.
        /// </summary>
        public Form1()
        {
            InitializeComponent();

            pictureBoxes ??= new List <PictureBox>();

            comboBox1.DataSource   = TestReflectionHelper.GetTypesWithHelpAttribute(typeof(VisualizerProviderAttribute)).ToList();
            comboBox1.ValueMember  = "Name";
            comboBox1.SelectedItem = null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// The main entry point.
        /// </summary>
        /// <param name="args">The args.</param>
        private static void Main(string[] args)
        {
            List <Type> types = null;

            if (args is not null)
            {
                types = new List <Type>();
                foreach (var arg in args)
                {
                    foreach (var type in TestReflectionHelper.GetTypesWithHelpAttributeByName(arg, typeof(SourceCodeLocationProviderAttribute)))
                    {
                        types.Add(type);
                    }
                }
            }
            if (types is null || !types.Any())
            {
                types = TestReflectionHelper.GetTypesWithHelpAttribute(typeof(SourceCodeLocationProviderAttribute)).ToList();
            }

            foreach (var testSetClass in types)
            {
                var testSet = HelperExtensions.ListStaticFactoryConstructorsList(testSetClass, typeof(List <SpeedTester>));
                var tests   = new List <SpeedTester>();
                tests.Clear();
                tests.AddRange(testSet[0]?.Invoke(null, null) as List <SpeedTester>);
                RunTestsAndBuildReport(
                    tests,
                    ((DisplayNameAttribute)testSetClass?.GetCustomAttribute(typeof(DisplayNameAttribute)))?.DisplayName,
                    ((DescriptionAttribute)testSetClass?.GetCustomAttribute(typeof(DescriptionAttribute)))?.Description,
                    ((SignatureAttribute)testSetClass?.GetMethods()?.FirstOrDefault(m => m?.GetCustomAttribute(typeof(SignatureAttribute)) != null)?.GetCustomAttribute(typeof(SignatureAttribute)))?.MethodSignature.Trim()
                    );
            }

            Console.WriteLine("Reports Generated.");
            //Console.WriteLine("[Press Any Key To Continue.]");
            //Console.ReadKey();
        }