Ejemplo n.º 1
0
        public void Test_ArgumentsMatch_InvalidType()
        {
            EntityOne e = new EntityOne();

            e.ID = Guid.NewGuid();

            MethodInfo method  = e.GetType().GetMethod("DoSomething");
            MethodInfo cMethod = method.MakeGenericMethod(typeof(IEntity));

            Type[] expectedArguments = new Type[] { typeof(string) };

            Type[] arguments = cMethod.GetGenericArguments();

            bool match = Reflector.ArgumentsMatch(cMethod, expectedArguments);

            Assert.IsFalse(match);
        }
Ejemplo n.º 2
0
        public void Test_ArgumentsMatch_Assignable()
        {
            EntityOne e = new EntityOne();

            e.ID = Guid.NewGuid();

            Type[] typeArguments = new Type[] { typeof(IEntity) };

            MethodInfo method  = e.GetType().GetMethod("DoSomething");
            MethodInfo cMethod = method.MakeGenericMethod(typeArguments);

            Type[] expectedArguments = new Type[] { typeof(EntityTwo) };

            bool match = Reflector.ArgumentsMatch(cMethod, expectedArguments);

            Assert.IsTrue(match);
        }