Skip to content

Instantly share code, notes, and snippets.

@jpv001
Last active August 29, 2015 14:19
Show Gist options
  • Save jpv001/d1a0d11d6bf94dc35d48 to your computer and use it in GitHub Desktop.
Save jpv001/d1a0d11d6bf94dc35d48 to your computer and use it in GitHub Desktop.
XUnit Linqpad Scaffold
void Main()
{
XunitHelpers.LaunchXunitGui(Assembly.GetExecutingAssembly());
}
#region Public XUnit Tests Here
public class TestThis
{
[Fact]
public void TestStuff()
{
Assert.True(true);
}
}
#endregion
#region XUnit
public static class XunitHelpers
{
// Needs xunit that includes gui, which they stopped supporting at v2 - use this one https://xunit.codeplex.com/downloads/get/423827
// Add the Xunit and Xunit.Extensions to the Additional Namespace Imports
public static void LaunchXunitGui(Assembly assembly)
{
// change the path to your xunit location
var xunitLocation = @"C:\xunit-master\1.9.1\";
const string xunitDllName = "xunit.dll";
var cmd = string.Format(@"""{0}{1}"" ""{2}""", xunitLocation, @"xunit.gui.clr4.exe", assembly.Location);
if(!File.Exists(Path.Combine(Path.GetDirectoryName(assembly.Location), xunitDllName)))
File.Copy(string.Format(@"{0}{1}", xunitLocation, xunitDllName), Path.Combine(Path.GetDirectoryName(assembly.Location), xunitDllName));
Util.Cmd (cmd);
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment