/// <summary>
 /// checks, if the type toCheck has a repository Id with id repId associated.
 /// </summary>
 /// <return>
 /// return true if present and equal, false otherwise
 /// </return>
 private bool TypeRepIdEquals(Type toCheck, String repId)
 {
     if (repId != null)
     {
         // check that repId is present on type from asm and that it is equal
         Object[] attrs = toCheck.GetCustomAttributes(typeof(RepositoryIDAttribute),
                                                      true);
         if (attrs.Length > 0)
         {
             RepositoryIDAttribute repIdAttr = (RepositoryIDAttribute)attrs[0];
             if (repIdAttr.Id.Equals(repId))
             {
                 return(true);
             }
             else
             {
                 // not equal
                 return(false);
             }
         }
         else
         {
             // no rep-id attr found
             return(false);
         }
     }
     else
     {
         // no rep-id to check -> ok
         return(true);
     }
 }
예제 #2
0
        /// <summary>
        /// Check, that the repository id attribute is present with
        /// the given id.
        /// </summary>
        protected void CheckRepId(Type testType, string expected)
        {
            object[] repAttrs =
                testType.GetCustomAttributes(ReflectionHelper.RepositoryIDAttributeType,
                                             false);
            Assert.AreEqual(1, repAttrs.Length, "wrong number of RepIDAttrs");
            RepositoryIDAttribute repId = (RepositoryIDAttribute)repAttrs[0];

            Assert.AreEqual(expected, repId.Id, "wrong repId");
        }