public TheoryCommand(IMethodInfo testMethod, object[] parameters, Type[] genericTypes) : base(testMethod, MethodUtility.GetDisplayName(testMethod), MethodUtility.GetTimeoutParameter(testMethod)) { int idx; Parameters = parameters ?? new object[0]; if (genericTypes != null && genericTypes.Length > 0) { string[] typeNames = new string[genericTypes.Length]; for (idx = 0; idx < genericTypes.Length; idx++) { typeNames[idx] = ConvertToSimpleTypeName(genericTypes[idx]); } DisplayName = String.Format("{0}<{1}>", DisplayName, string.Join(", ", typeNames)); } ParameterInfo[] parameterInfos = testMethod.MethodInfo.GetParameters(); string[] displayValues = new string[Math.Max(Parameters.Length, parameterInfos.Length)]; for (idx = 0; idx < Parameters.Length; idx++) { displayValues[idx] = ParameterToDisplayValue(GetParameterName(parameterInfos, idx), Parameters[idx]); } for (; idx < parameterInfos.Length; idx++) // Fill-in any missing parameters with "???" { displayValues[idx] = parameterInfos[idx].Name + ": ???"; } DisplayName = String.Format("{0}({1})", DisplayName, string.Join(", ", displayValues)); }
public void ReturnsDisplayNameFromFact() { string methodName = "WithDisplayName"; Type testClassType = typeof(ClassWithDisplayName); MethodInfo methodInfo = testClassType.GetMethod(methodName); var result = MethodUtility.GetDisplayName(Reflector.Wrap(methodInfo)); Assert.Equal("My Display Name", result); }
public void ReturnsNullWithNoDisplayName() { string methodName = "WithoutDisplayName"; Type testClassType = typeof(ClassWithDisplayName); MethodInfo methodInfo = testClassType.GetMethod(methodName); var result = MethodUtility.GetDisplayName(Reflector.Wrap(methodInfo)); Assert.Null(result); }
protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo testMethod) { if (Helper.Credentials == null) { yield return(new SkipCommand(testMethod, MethodUtility.GetDisplayName(testMethod), "Automation settings not configured. Please set the OCTOKIT_GITHUBUSERNAME and OCTOKIT_GITHUBPASSWORD environment variables to a GitHub test account (i.e, DO NOT USE A \"REAL\" ACCOUNT).")); } else { yield return(new FactCommand(testMethod)); } }
public IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo testMethod) { string skipReason = MethodUtility.GetSkipReason(testMethod); if (skipReason != null) { yield return(new SkipCommand(testMethod, MethodUtility.GetDisplayName(testMethod), skipReason)); } else { yield return(new FixtureCommand(new FactCommand(testMethod), _fixtures)); } }
protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo testMethod) { if (Helper.Organization == null) { return new[] { new SkipCommand(testMethod, MethodUtility.GetDisplayName(testMethod), "Automation settings not configured. Please set the OCTOKIT_GITHUBORGANIZATION environment variable to a GitHub organization owned by the test account specified in OCTOKIT_GITHUBUSERNAME.") } } ; else { return(base.EnumerateTestCommands(testMethod)); } }
public SpecCommand(IMethodInfo method, bool liveOnly) : base(method, MethodUtility.GetDisplayName(method), MethodUtility.GetTimeoutParameter(method)) { this.LiveOnly = liveOnly; }
public ReleaseCommand(TheoryCommand theory, IMethodInfo method) : base(method, MethodUtility.GetDisplayName(method), MethodUtility.GetTimeoutParameter(method)) { this.theory = theory; }
/// <param name="innerCommand">The <see cref="ITestCommand"/> to wrap</param> /// <param name="method">The method being used as a test</param> public IocLifetimeCommand(ITestCommand innerCommand, IMethodInfo method) : base(method, MethodUtility.GetDisplayName(method), MethodUtility.GetTimeoutParameter(method)) { _innerCommand = innerCommand; }