Exemplo n.º 1
0
 public void ClassCountInternal()
 {
     // internal does not have a dedicated flag and any non-public is internal
     var result = new RawQuery().Select("select count(*) from type where typeAttributes & {0} = 0",
         (int)TypeAttributes.Public).ToList();
     Assert.AreEqual(1, result.Count);
 }
Exemplo n.º 2
0
 public void CheckAssemblies()
 {
     var asm = new RawQuery().
         Select("select * from assembly where fileName='CodeQL.Testing.dll'").
         ToList();
     Assert.AreEqual(1, asm.Count, "Expect to find just one assembly");
 }
Exemplo n.º 3
0
 public void AssemblyAttributesShort()
 {
     // AssemblyTitle("CodeQL.Testing")]
     var attributes = new RawQuery().
         Select(@"select * from assembly asm
     join attribute att on att belongs to asm and att.name='AssemblyTitle'
     join property pr on pr belongs to att and property.name='Title'").ToList();
     Assert.AreEqual(1, attributes.Count, "Expect just one AssemblyTitle attribute");
 }
Exemplo n.º 4
0
 public void PrivateMethodsInClass()
 {
     #region sql
     string sql = string.Format(@"select count(*)
     from xobject o
     join type t on t.id=o.id and t.namespace='CodeQL.Testing'
     join xobject p on p.type=13 and p.parentId=o.id
     join property pr on pr.id=p.id
     and pr.visibility
     where o.type=4 and o.name='InternalClass'", (int)Visibility.Private);
     #endregion
     var res = new RawQuery().Select(sql).ToList();
     Assert.AreEqual(1, res.Count);
 }
Exemplo n.º 5
0
 public void MethodsInClass()
 {
     #region sql
     string sql = @"select count(*)
     from xobject o
     join type t on t.id=o.id and t.namespace='CodeQL.Testing'
     join xobject p on p.type=13 and p.parentId=o.id
     where o.type=4 and o.name='InternalClass'";
     #endregion
     var res = new RawQuery().Select(sql).ToList();
     Assert.AreEqual(1, res.Count);
 }
Exemplo n.º 6
0
 public void ClassCount()
 {
     object result = new RawQuery().SelectScalar("select count(*) from type");
     Assert.IsAssignableFrom(typeof(long), result);
     Assert.AreEqual(8, (long)result);
 }