public void TestSimilarFiles()
        {
            var file = PathUtilities.GetAdjacentFile(@"..\Email\EmailTest.Testname.Microsoft_Windows_10_Education.approved.eml");
            var approvalsFilename = ApprovalsFilename.Parse(file);

            Approvals.VerifyAll("Like EmailTest.Testname.Microsoft_Windows_10_Education.approved.eml", approvalsFilename.GetOtherMachineSpecificFiles(), f => f.Name);
        }
        public void TestMachineSpecificName()
        {
            // begin-snippet: approvals_filename
            var approvalsFilename = ApprovalsFilename.Parse(@"..\Email\EmailTest.Testname.Microsoft_Windows_10_Education.approved.eml");

            // end-snippet
            Approvals.Verify(approvalsFilename);
            Assert.True(approvalsFilename.IsMachineSpecific);
        }
Exemplo n.º 3
0
 public void Report(string approved, string received)
 {
     if (IsWorkingInThisEnvironment(approved))
     {
         var info    = ApprovalsFilename.Parse(approved);
         var nearest = info.GetOtherMachineSpecificFiles().OrderByDescending(f => f.LastWriteTimeUtc).FirstOrDefault();
         if (nearest != null)
         {
             var text = File.ReadAllText(nearest.FullName);
             File.WriteAllText(approved, $"Copied from: {nearest.Name}\n{text}", Encoding.UTF8);
         }
     }
     DiffReporter.INSTANCE.Report(approved, received);
 }
Exemplo n.º 4
0
        public bool IsWorkingInThisEnvironment(string forFile)
        {
            var info = ApprovalsFilename.Parse(forFile);

            return(info.IsMachineSpecific && info.ForApproved().IsEmptyFile());
        }
 public void TestNonMachineSpecificName()
 {
     Approvals.Verify(ApprovalsFilename.Parse(@"..\Email\EmailTest.Testname.approved.eml"));
 }