public bool IsTestMethod(IMethodInfo testMethod)
        {
            // The ObservationAttribute is really not even required; we could just say any void-returning public
            // method is a test method (or you could say it has to start with "should").

            return(testMethod.HasAttribute(typeof(ObservationAttribute)));
        }
        public IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo testMethod) {
            foreach (var testCommand in _classCommand.EnumerateTestCommands(testMethod)) {
                if (testMethod.HasAttribute(typeof(FullTrustAttribute))
                    || testCommand is PartialTrustCommand) {
                    yield return testCommand;
                    continue;
                }

                yield return new PartialTrustCommand(testCommand);
            }
        }
예제 #3
0
        private bool ValidateRequirements(IMethodInfo method)
        {
            if (method.HasAttribute(typeof(RuntimeTestAttribute)))
            {
                RuntimeTestAttribute attr = method.GetCustomAttributes(typeof(RuntimeTestAttribute)).First().GetInstance <RuntimeTestAttribute>();
                if (!(RuntimeTestAttribute.RuntimeTestsEnabled || Debugger.IsAttached))
                {
                    this.Skip = String.Format("Runtime tests are not enabled on this test environment. To enable runtime tests set the environment variable '{0}'=true or run the tests under a debugger.", RuntimeTestAttribute.RuntimeTestsEnabledEnvironmentVariable);
                    return(false);
                }
                else if (!(attr.NonPrivileged || UacUtilities.IsProcessElevated))
                {
                    this.Skip = String.Format("The runtime test '{0}' requires that the test process be elevated.", method.Name);
                    return(false);
                }
            }
            else if (method.HasAttribute(typeof(Is64BitSpecificTestAttribute)) && !Is64BitSpecificTestAttribute.Is64BitOperatingSystem)
            {
                this.Skip = "64-bit specific tests are not enabled on 32-bit machines.";
                return(false);
            }

            return(true);
        }
        public IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo testMethod)
        {
            foreach (var testCommand in _classCommand.EnumerateTestCommands(testMethod))
            {
                if (testMethod.HasAttribute(typeof(FullTrustAttribute)) ||
                    testCommand is PartialTrustCommand)
                {
                    yield return(testCommand);

                    continue;
                }

                yield return(new PartialTrustCommand(testCommand));
            }
        }
예제 #5
0
        private bool ValidateRequirements(IMethodInfo method)
        {
            if (method.HasAttribute(typeof(RuntimeTestAttribute)))
            {
                RuntimeTestAttribute attr = method.GetCustomAttributes(typeof(RuntimeTestAttribute)).First().GetInstance<RuntimeTestAttribute>();
                if (!(RuntimeTestAttribute.RuntimeTestsEnabled || Debugger.IsAttached))
                {
                    this.Skip = String.Format("Runtime tests are not enabled on this test environment. To enable runtime tests set the environment variable '{0}'=true or run the tests under a debugger.", RuntimeTestAttribute.RuntimeTestsEnabledEnvironmentVariable);
                    return false;
                }
                else if (!(attr.NonPrivileged || UacUtilities.IsProcessElevated))
                {
                    this.Skip = String.Format("The runtime test '{0}' requires that the test process be elevated.", method.Name);
                    return false;
                }
            }
            else if (method.HasAttribute(typeof(Is64BitSpecificTestAttribute)) && !Is64BitSpecificTestAttribute.Is64BitOperatingSystem)
            {
                this.Skip = "64-bit specific tests are not enabled on 32-bit machines.";
                return false;
            }

            return true;
        }
예제 #6
0
 public static bool IsTest(IMethodInfo method)
 {
     return !method.IsAbstract &&
             method.HasAttribute(typeof(FactAttribute));
 }
예제 #7
0
 public static bool HasTraits(IMethodInfo method)
 {
     return method.HasAttribute(typeof(TraitAttribute))
         || method.Class.HasAttribute(typeof(TraitAttribute));
 }
예제 #8
0
 public static bool IsTest(IMethodInfo method)
 {
     return(!method.IsAbstract &&
            method.HasAttribute(typeof(FactAttribute)));
 }
예제 #9
0
 public static bool HasTraits(IMethodInfo method)
 {
     return(method.HasAttribute(typeof(TraitAttribute)) ||
            method.Class.HasAttribute(typeof(TraitAttribute)));
 }
 private static bool IsSpec(IMethodInfo testMethod)
 {
     return testMethod.HasAttribute(typeof(SpecForAttribute));
 }
 private static bool IsVerifyMethod(IMethodInfo testMethod)
 {
     return testMethod.HasAttribute(typeof(FactAttribute));
 }
예제 #12
0
        /// <summary>
        /// Determines whether a test method has traits.
        /// </summary>
        /// <param name="method">The method to be inspected</param>
        /// <returns>True if the method has traits; false, otherwise</returns>
        public static bool HasTraits(IMethodInfo method)
        {
            Guard.ArgumentNotNull("method", method);

            return method.HasAttribute(typeof(TraitAttribute))
                || method.Class.HasAttribute(typeof(TraitAttribute));
        }
예제 #13
0
 public bool HasAttribute(Type attributeType)
 {
     return(_method.HasAttribute(attributeType));
 }
예제 #14
0
        public bool IsTestMethod(IMethodInfo testMethod)
        {
            // The ObservationAttribute is really not even required; we could just say any void-returning public
            // method is a test method (or you could say it has to start with "should").

            return testMethod.HasAttribute(typeof(ObservationAttribute));
        }
예제 #15
0
        /// <summary>
        /// Determines whether a method is a test method. A test method must be decorated
        /// with the <see cref="FactAttribute"/> (or derived class) and must not be abstract.
        /// </summary>
        /// <param name="method">The method to be inspected</param>
        /// <returns>True if the method is a test method; false, otherwise</returns>
        public static bool IsTest(IMethodInfo method)
        {
            Guard.ArgumentNotNull("method", method);

            return !method.IsAbstract &&
                    method.HasAttribute(typeof(FactAttribute));
        }
예제 #16
0
 public bool HasAttribute(Type attributeType)
 {
     return(_originalMethodInfo.HasAttribute(attributeType));
 }
 public bool IsTestMethod(IMethodInfo testMethod)
 {
     return testMethod.HasAttribute(typeof(FactAttribute));
 }