private ICollection <string> GetTestedMethods(DefaultService service) { var allTestTypes = this.GetType().Assembly.GetTypes(); var genericType = typeof(ServiceTestClass <>); var serviceTestType = genericType.MakeGenericType(service.GetType()); var testClasses = allTestTypes.Where(t => serviceTestType.IsAssignableFrom(t)); var steps = new List <string>(); foreach (var testClass in testClasses) { var testMethods = testClass.GetMethods().Where(m => m.GetCustomAttributes(typeof(TestMethodAttribute), false).FirstOrDefault() != null); foreach (var testMethod in testMethods) { var methodAttribute = testMethod.GetCustomAttributes(typeof(ServiceMethodNameAttribute), false).FirstOrDefault() as ServiceMethodNameAttribute; if (methodAttribute != null && !string.IsNullOrEmpty(methodAttribute.MethodName)) { steps.Add(methodAttribute.MethodName); } } } return(steps); }