Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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));
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
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"));
         }
     }
 }
Exemplo n.º 5
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);
         }
     }
 }