Exemple #1
0
        public void GetAll_ArtifactsFolderMissing_FolderIsCreated()
        {
            using (var folder = new TempFolderAdapter())
            {
                SetupFolderPathConfig(folder.BasePath);

                target.GetAll();

                Assert.That(folder.SubFolderExists(FileProvider.ArtifactsFolderName));
            }
        }
Exemple #2
0
        public void GetAll_EmptySubFolder_DoesNotReturnFolder()
        {
            using(var folder=new TempFolderAdapter(FileProvider.ArtifactsFolderName))
               {
               SetupFolderPathConfig(folder.BasePath);
               folder.AddFolder("subFolder");

               var result = target.GetAll().ToList();

               Assert.That(result, Is.Empty);
               }
        }
Exemple #3
0
        public void GetAll_FileOutsideArtifactsFolder_NotReturned()
        {
            using (var folder = new TempFolderAdapter())
            {
                folder.AddFolder(FileProvider.ArtifactsFolderName);
                folder.AddFile("a", "b");
                SetupFolderPathConfig(folder.BasePath);

                var result = target.GetAll().ToList();

                Assert.That(result,Is.Empty);
            }
        }
Exemple #4
0
 public void GetAll_FilesInSubFolders_FilesAreReturned()
 {
     using (var folder = new TempFolderAdapter(FileProvider.ArtifactsFolderName))
     {
         SetupFolderPathConfig(folder.BasePath);
         folder.AddFile("a", "b").AddFolder("subFolder").AddFile("c", "d").AddFolder("sub sub").AddFile("e", "f");
         var result = 0;
         foreach (var artifactStream in target.GetAll())using(artifactStream)
         {
             result++;
         }
         Assert.That(result, Is.EqualTo(3));
     }
 }
Exemple #5
0
 public void GetAll_TwoFilesInArtifactsFolder_ReturnsTwoFiles()
 {
     using (var folder = new TempFolderAdapter(FileProvider.ArtifactsFolderName))
     {
         SetupFolderPathConfig(folder.BasePath);
         folder.AddFile("abc", "def").AddFile("ghi","jkl");
         bool firstFileWasFound=false, secondFileWasFound = false;
         foreach (var file in target.GetAll())using(file)
         {
             if (file.Id == Path.Combine(folder.Path, "abc")) firstFileWasFound = true;
             if (file.Id == Path.Combine(folder.Path, "ghi")) secondFileWasFound = true;
         }
         Assert.That(firstFileWasFound,Is.True);
         Assert.That(secondFileWasFound,Is.True);
     }
 }
Exemple #6
0
 public void Setup_FolderMissing_CreatesFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path + @"\setupFolder");
         Assert.That(folder.SubFolderExists("setupFolder"));
     }
 }
Exemple #7
0
 public void Setup_FolderMissing_CreatesConfigurationFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path + @"\setupFolder");
         Assert.That(folder.SubFolderExists("setupFolder\\"+FileProvider.ConfigurationFolderName));
     }
 }
Exemple #8
0
 public void Setup_FolderExists_DoesNotCreateFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path);
         Assert.That(folder.SubFolderExists(folder.Name),Is.False);
     }
 }
Exemple #9
0
        public void Get_FileMissing_Throws()
        {
            using (var folder = new TempFolderAdapter(FileProvider.ArtifactsFolderName))
            {
                SetupFolderPathConfig(folder.BasePath);

                ActualValueDelegate targetAction = () => target.Get("a");
                Assert.That(targetAction, Throws.TypeOf<FileNotFoundException>());
            }
        }
Exemple #10
0
 public void Get_ExistingFilePath_ReturnsStreamWithSameContent()
 {
     using (var folder = new TempFolderAdapter(FileProvider.ArtifactsFolderName))
     {
         folder.AddFile("a", "abc");
         SetupFolderPathConfig(folder.BasePath);
         using (var reader = new StreamReader(target.Get("a")))
         {
             string result = reader.ReadToEnd();
             Assert.That(result, Is.EqualTo("abc"));
         }
     }
 }
Exemple #11
0
 public void Get_ExistingFilePath_ReturnsStream()
 {
     using (var folder=new TempFolderAdapter(FileProvider.ArtifactsFolderName))
     {
         folder.AddFile("a", "b");
         SetupFolderPathConfig(folder.BasePath);
         using (var result = target.Get("a"))
         {
             Assert.That(result, Is.Not.Null);
         }
     }
 }