internal TestMethodInfo(ITestResultEndPoint results, MethodInfo method) { Throw.If.Object.IsNull(results, nameof(results)); Throw.If.Object.IsNull(method, nameof(method)); _results = results; _methodInfo = method; _parameters = _methodInfo.GetParameters(); _genericArguments = _methodInfo.GetGenericArguments(); _attributes = _methodInfo.GetCustomAttributes().Where(attr => attr is TestDataAttribute || attr is TestParametersAttribute); }
/// <summary> /// Creates a new instance of <see cref="Remote{TRemoteConfiguration, TClientConfiguration}"/>. /// </summary> /// <param name="configuration">The remote configuration object.</param> /// <param name="link">The link object used to communicate with the client.</param> public Remote(TRemoteConfiguration configuration, IServerLink link) { Throw.If.Object.IsNull(configuration, nameof(configuration)); Throw.If.Object.IsNull(link, nameof(link)); Configuration = configuration; if (!Configuration.StartClientVisible) { Configuration.ClientConfiguration.AutoShutdown = true; } Link = link; Factory.Instance.Create(out ITestResultEndPoint result); Results = result; }
private void CollectTestMethods(Assembly assembly, ITestResultEndPoint results, out IList <TestMethodInfo> sequentialTestMethods, out IList <TestMethodInfo> parallelTestMethods) { _log.Debug(nameof(CollectTestMethods)); sequentialTestMethods = new List <TestMethodInfo>(); parallelTestMethods = new List <TestMethodInfo>(); foreach (Type type in assembly.GetTypes()) { _log.Debug($"Searching type {type.Format()}."); TestClassAttribute c_attr = type.GetCustomAttribute <TestClassAttribute>(); TestMode classLevelMode = c_attr != null ? c_attr.TestMode : TestMode.Parallel; Boolean classLevelIgnore = c_attr != null && c_attr.IsIgnored; foreach (MethodInfo testMethod in type.GetRuntimeMethods().Where(m => m.GetCustomAttributes <TestMethodAttribute>().Count() > 0)) { _log.Info($"Found test method {type.Format()}.{testMethod.Name.Format()}."); TestMethodAttribute m_attr = testMethod.GetCustomAttribute <TestMethodAttribute>(); if (classLevelIgnore) { _log.Debug($"Class ignored: {c_attr.IgnoreReason.Format()}"); results.IgnoreTestMethod(testMethod, $"Class ignored: {c_attr.IgnoreReason.Format()}"); } else if (m_attr.IsIgnored) { _log.Debug($"Method ignored: {m_attr.IgnoreReason.Format()}"); results.IgnoreTestMethod(testMethod, $"Method ignored: {m_attr.IgnoreReason.Format()}"); } else { if (classLevelMode == TestMode.Sequential || m_attr.TestMode == TestMode.Sequential || Configuration.TestMethodModeOverride == TestModeOverrides.Sequential) { _log.Info($"Adding sequential test method {type.Format()}.{testMethod.Name.Format()}."); sequentialTestMethods.Add(new TestMethodInfo(results, testMethod)); } else { _log.Info($"Adding parallel test method {type.Format()}.{testMethod.Name.Format()}."); parallelTestMethods.Add(new TestMethodInfo(results, testMethod)); } } } } }
public Executor(IExecutorConfiguration configuration) { Throw.If.Object.IsNull(configuration, nameof(configuration)); Configuration = configuration; Factory.Instance.Create(out ITestResultEndPoint results); Results = results; _headerContent.Add(@" _ _ _ _____ _ "); _headerContent.Add(@"| \ | | _ _ ___ | | ___ __ _ _ __|_ _|___ ___ | |_ "); _headerContent.Add(@"| \| || | | | / __|| | / _ \ / _` || '__| | | / _ \/ __|| __|"); _headerContent.Add(@"| |\ || |_| || (__ | || __/| (_| || | _ | || __/\__ \| |_ "); _headerContent.Add(@"|_| \_| \__,_| \___||_| \___| \__,_||_|(_) |_| \___||___/ \__|"); _headerContent.Add(@" ____ _ "); _headerContent.Add(@" / ___| ___ _ __ ___ ___ | | ___ "); _headerContent.Add(@"| | / _ \ | '_ \ / __| / _ \ | | / _ \ "); _headerContent.Add(@"| |___| (_) || | | |\__ \| (_) || || __/ "); _headerContent.Add(@" \____|\___/ |_| |_||___/ \___/ |_| \___| "); _headerContent.Add(@" "); }
public void Create(out ITestResultEndPoint @object) => @object = new TestResultEndPoint();