private static void AssertApprover(string receivedFile, string approvedFile, bool expected) { var basePath = PathUtilities.GetDirectoryForCaller(); var fileApprover = new FileApprover(null, null).Approve(basePath + approvedFile, basePath + receivedFile); Assert.AreEqual(expected, fileApprover == null); }
private static void AssertApprover(string receivedFile, string approvedFile, bool expected) { var basePath = Environment.CurrentDirectory + @"\..\..\"; var exception = FileApprover.Approve(basePath + approvedFile, basePath + receivedFile); Assert.AreEqual(expected, exception == null); }
public static void Verify(IApprovalWriter writer, IApprovalNamer namer, IApprovalFailureReporter reporter) { var normalizeLineEndingsForTextFiles = CurrentCaller.GetFirstFrameForAttribute <IgnoreLineEndingsAttribute>(); var shouldIgnoreLineEndings = normalizeLineEndingsForTextFiles == null || normalizeLineEndingsForTextFiles.IgnoreLineEndings; var approver = new FileApprover(writer, namer, shouldIgnoreLineEndings); Verify(approver, reporter); }
public void LineEndingAreNotIgnored() { var basePath = PathUtilities.GetDirectoryForCaller(); var approvedFile = basePath + "UnixLineEndings.txt"; var receivedFile = basePath + "WindowsLineEndings.txt"; File.WriteAllText(approvedFile, "Foo\nBar"); File.WriteAllText(receivedFile, "Foo\r\nBar"); var fileApprover = new FileApprover(null, null).Approve(approvedFile, receivedFile); Assert.IsInstanceOf <ApprovalMismatchException>(fileApprover); }
public void LineEndingsAreIgnored() { var basePath = PathUtilities.GetDirectoryForCaller(); var approvedFile = basePath + "UnixLineEndings.txt"; var receivedFile = basePath + "WindowsLineEndings.txt"; File.WriteAllText(approvedFile, "Foo\nBar"); File.WriteAllText(receivedFile, "Foo\r\nBar"); var fileApprover = new FileApprover(null, null, true).Approve(approvedFile, receivedFile); Assert.IsNull(fileApprover); }