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); } }
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)); } }
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 static bool IsTest(IMethodInfo method) { return !method.IsAbstract && method.HasAttribute(typeof(FactAttribute)); }
public static bool HasTraits(IMethodInfo method) { return method.HasAttribute(typeof(TraitAttribute)) || method.Class.HasAttribute(typeof(TraitAttribute)); }
public static bool IsTest(IMethodInfo method) { return(!method.IsAbstract && method.HasAttribute(typeof(FactAttribute))); }
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)); }
/// <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)); }
public bool HasAttribute(Type attributeType) { return(_method.HasAttribute(attributeType)); }
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)); }
/// <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)); }
public bool HasAttribute(Type attributeType) { return(_originalMethodInfo.HasAttribute(attributeType)); }
public bool IsTestMethod(IMethodInfo testMethod) { return testMethod.HasAttribute(typeof(FactAttribute)); }