private string GetArguments(NUnitArgs args) { var list = new List <string>(); if (args.ExcludeCategory != null) { list.Add("-exclude:{0}".F(args.ExcludeCategory)); } if (args.IncludeCategory != null) { list.Add("-include:{0}".F(args.IncludeCategory)); } if (args.Fixture != null) { list.Add("-fixture:\"{0}\"".F(args.Fixture)); } if (args.Labels.HasValue && args.Labels.Value) { list.Add("-labels"); } if (args.NoLogo.HasValue && args.NoLogo.Value) { list.Add("-nologo"); } if (args.ShadowCopy.HasValue && !args.ShadowCopy.Value) { list.Add("-noshadow"); } if (args.XmlOutputPath != null) { list.Add("-xml:\"{0}\"".F(args.XmlOutputPath)); } if (args.XsltTransformPath != null) { list.Add("-transform:\"{0}\"".F(args.XsltTransformPath)); } return(string.Join(" ", list)); }
public void Test(IEnumerable <BuildItem> assemblies, Action <NUnitArgs> config) { using (_tracer.StartTask("Nunit")) { var args = new NUnitArgs(); if (config != null) { config(args); } _tracer.Info("Testing '{0}'.", string.Join(", ", assemblies)); var exitCode = _process.Exec(p => { p.StartInfo.FileName = GetExecutable(args.ToolPath); p.StartInfo.Arguments = GetArguments(args) + " " + string.Join(" ", assemblies.Select(a => "\"{0}\"".F(a))); }); if (exitCode != 0) { throw new BuildCsException("NUnit failed with exit code '{0}'.".F(exitCode)); } } }