Skip to content

Instantly share code, notes, and snippets.

@jamesrcounts
Created March 16, 2012 02:36
Show Gist options
  • Save jamesrcounts/2048180 to your computer and use it in GitHub Desktop.
Save jamesrcounts/2048180 to your computer and use it in GitHub Desktop.
A VS 11 DiffReporter for ApprovalTests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ApprovalTests.Reporters
{
public class DevEnvDiffReporter : GenericDiffReporter
{
public static readonly DevEnvDiffReporter INSTANCE = new DevEnvDiffReporter();
public DevEnvDiffReporter()
: base(
"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\devenv.exe",
"/diff \"{0}\" \"{1}\"",
"Only works with VS11")
{
}
}
}
using ApprovalTests.Reporters;
using ApprovalUtilities.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ApprovalTests.Tests.Reporters
{
[TestClass]
public class DevEnvDiffReporterTest
{
[TestMethod]
[UseReporter(typeof(FileLauncherReporter))]
public void DevEnvTest()
{
var dir = PathUtilities.GetDirectoryForCaller();
string a = dir + "a.txt";
System.IO.File.WriteAllText(a, "text a");
string b = dir + "b.txt";
System.IO.File.WriteAllText(b, "text b");
var args = new DevEnvDiffReporter().GetLaunchArguments(a, b);
Approvals.VerifyWithCallback(args, launchargs => GenericDiffReporterTest.StartProcess(launchargs));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment