public void InvalidQueryFunctionTest() { var tests = QueryHarness.CreateFromType(typeof(InvalidQueryFunctions)); Assert.AreEqual(0, tests.Count()); }
public void NoQueriesTest() { var tests = QueryHarness.CreateFromType(typeof(EmptyClass)); Assert.AreEqual(0, tests.Count()); }
public bool processBuiltDlls(List <string> dlls) { Assembly assembly; List <ITransform> transforms = new List <ITransform>(); string msg = ""; foreach (var dll in dlls) { try { var bytes = File.ReadAllBytes(dll); assembly = Assembly.Load(bytes); var newTypes = assembly.GetTypes(); foreach (var type in newTypes) { try { if (null != type.GetInterface("ABB.SrcML.ITransform") && "ABB.SrcML" != type.Namespace) { ITransform test = new TransformObjectHarness(type); transforms.Add(test); } else { foreach (var test in QueryHarness.CreateFromType(type)) { transforms.Add(test); } } } catch (MissingMethodException e) { messageLabel.Text = String.Format("Could not load {0}({1})", type.FullName, e.Message); } } } catch (ReflectionTypeLoadException e) { msg = String.Format("{0}\n", e); foreach (var le in e.LoaderExceptions) { msg += le.ToString(); } } catch (Exception e) { msg = e.ToString(); } finally { if (0 < msg.Length) { MessageBox.Show(msg); } } } int index = transformComboBox.SelectedIndex; transformComboBox.DataSource = transforms; transformComboBox.DisplayMember = "Name"; if (index < transforms.Count) { transformComboBox.SelectedIndex = index; } else { transformComboBox.SelectedIndex = transforms.Count - 1; } messageLabel.Text = String.Format("Loaded {0} transforms.", transforms.Count); return(true); }