public void FolderComparison_DifferentFilesInFolders_FalseAndListOfDifferentFiles()
        {
            using (var temporaryFolder1 = new TemporaryFolder())
            using (var temporaryFolder2 = new TemporaryFolder())
            {
                temporaryFolder1.CreateFile("test1.txt");
                temporaryFolder1.CreateFile("test2.txt");
                temporaryFolder2.CreateFile("test1.txt");
                temporaryFolder2.CreateFile("test3.txt");

                IFolderComparisonReport folderComparisonReport = temporaryFolder1.Compare(temporaryFolder2, ReportOption.CollectDifferentFiles);
                CollectionAssert.AreEqual(new[] {"test2.txt"}, folderComparisonReport.Folder1Files);
                CollectionAssert.AreEqual(new[] {"test3.txt"}, folderComparisonReport.Folder2Files);
                Assert.That(folderComparisonReport.Equal, Is.False);
            }
        }
 public void FolderComparison_FoldersWith1SameFile_True()
 {
     using (var temporaryFolder1 = new TemporaryFolder())
     using (var temporaryFolder2 = new TemporaryFolder())
     {
         temporaryFolder1.CreateFile("file_1");
         temporaryFolder2.CreateFile("file_1");
         IFolderComparisonReport report = temporaryFolder1.Compare(temporaryFolder2);
         Assert.That(report.Equal, Is.True);
     }
 }
        public void FolderComparison_FilesListNotFoundInFolderAndSubFolder_False()
        {
            using (var temporaryFolder = new TemporaryFolder())
            {
                temporaryFolder.CreateFile("file1.txt");
                temporaryFolder.CreateFile("file2.txt");
                IFolder subFolder = temporaryFolder.CreateFolder("subFolder");
                subFolder.CreateFile("subFolderFile1.dat");

                string[] filesList = new StringBuilder()
                    .AppendLine("file1.txt")
                    .AppendLine("file2.txt")
                    .AppendLine(@"subFolder\subFolderFile1.dat")
                    .AppendLine(@"subFolder\subFolderFile2.dat")
                    .ToString()
                    .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                IFolderComparisonReport folderComparisonReport = temporaryFolder.Compare(filesList);
                Assert.That(folderComparisonReport.Equal, Is.False);
            }
        }
 public void FolderComparison_Folder1With1FileAndFolder2With2Files_False()
 {
     using (var temporaryFolder1 = new TemporaryFolder())
     using (var temporaryFolder2 = new TemporaryFolder())
     {
         temporaryFolder1.CreateFile("file1_1");
         temporaryFolder2.CreateFile("file2_1");
         temporaryFolder2.CreateFile("file2_2");
         IFolderComparisonReport report = temporaryFolder1.Compare(temporaryFolder2);
         Assert.That(report.Equal, Is.False);
     }
 }
        public static IFolderComparisonReport Compare(this IFolder folder1, string[] folderContent2, ReportOption reportOption = ReportOption.EqualOnly)
        {
            if (folderContent2 == null)
            {
                IFolder folder2 = null;
                return folder1.Compare(folder2);
            }

            using (var temporaryFolder = new TemporaryFolder())
            {
                foreach (string folderEntity in folderContent2)
                {
                    temporaryFolder.CreateFile(folderEntity);
                }
                return folder1.Compare(temporaryFolder, reportOption);
            }
        }