Exemple #1
0
        public void StaticQueryCreationWithoutDefaultConstructorTest()
        {
            QueryHarness q = new QueryHarness(typeof(StaticVsNonStaticQueryFunctions), "StaticMyQuery");

            Assert.IsNotNull(q);
        }
Exemple #2
0
 public void QueryCreationWithoutDefaultConstructorTest()
 {
     QueryHarness q = new QueryHarness(typeof(StaticVsNonStaticQueryFunctions), "MyQuery");
 }
Exemple #3
0
 public void QueryFunctionWithBadSignature()
 {
     QueryHarness harness = new QueryHarness(typeof(InvalidQueryFunctions), "test2");
 }
Exemple #4
0
        public void NoQueriesTest()
        {
            var tests = QueryHarness.CreateFromType(typeof(EmptyClass));

            Assert.AreEqual(0, tests.Count());
        }
Exemple #5
0
 public void QueryFunctionWithNullMethod()
 {
     QueryHarness harness = new QueryHarness(typeof(EmptyClass), (MethodInfo)null);
 }
Exemple #6
0
 public void QueryFunctionWithMissingMethod()
 {
     QueryHarness harness = new QueryHarness(typeof(InvalidQueryFunctions), "test3");
 }
Exemple #7
0
        public void InvalidQueryFunctionTest()
        {
            var tests = QueryHarness.CreateFromType(typeof(InvalidQueryFunctions));

            Assert.AreEqual(0, tests.Count());
        }
Exemple #8
0
 public void QueryFunctionWithNullType()
 {
     QueryHarness harness = new QueryHarness(null, "test2");
 }
 public void StaticQueryCreationWithoutDefaultConstructorTest()
 {
     QueryHarness q = new QueryHarness(typeof(StaticVsNonStaticQueryFunctions), "StaticMyQuery");
     Assert.IsNotNull(q);
 }
 public void QueryCreationWithoutDefaultConstructorTest()
 {
     QueryHarness q = new QueryHarness(typeof(StaticVsNonStaticQueryFunctions), "MyQuery");
 }
 public void QueryFunctionWithBadSignature()
 {
     QueryHarness harness = new QueryHarness(typeof(InvalidQueryFunctions), "test2");
 }
 public void QueryFunctionWithMissingMethod()
 {
     QueryHarness harness = new QueryHarness(typeof(InvalidQueryFunctions), "test3");
 }
 public void QueryFunctionWithNullMethod()
 {
     QueryHarness harness = new QueryHarness(typeof(EmptyClass), (MethodInfo)null);
 }
 public void QueryFunctionWithNullType()
 {
     QueryHarness harness = new QueryHarness(null, "test2");
 }
        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);
        }