Created
October 2, 2012 03:25
-
-
Save jamesrcounts/3815982 to your computer and use it in GitHub Desktop.
A dumbed down version of FileApprover, that makes Verifying two arbitrary text files easier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TheoryApprover : IApprovalApprover | |
| { | |
| private readonly string approved; | |
| private readonly string received; | |
| private ApprovalException failure; | |
| public TheoryApprover(string approved, string received) | |
| { | |
| this.received = received; | |
| this.approved = approved; | |
| } | |
| public bool Approve() | |
| { | |
| this.failure = FileApprover.Approve(approved, received); | |
| return this.failure == null; | |
| } | |
| public void CleanUpAfterSucess(IApprovalFailureReporter reporter) | |
| { | |
| // TODO: Remove duplication with FileApprover. | |
| File.Delete(received); | |
| if (reporter is IApprovalReporterWithCleanUp) | |
| { | |
| ((IApprovalReporterWithCleanUp)reporter).CleanUp(approved, received); | |
| } | |
| } | |
| public void Fail() | |
| { | |
| throw failure; | |
| } | |
| public void ReportFailure(IApprovalFailureReporter reporter) | |
| { | |
| reporter.Report(approved, received); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment