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

                target.GetAll();

                Assert.That(folder.SubFolderExists(FileProvider.ArtifactsFolderName));
            }
        }
示例#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);
               }
        }
示例#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);
            }
        }
示例#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));
     }
 }
示例#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);
     }
 }
示例#6
0
 public void Setup_FolderMissing_CreatesFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path + @"\setupFolder");
         Assert.That(folder.SubFolderExists("setupFolder"));
     }
 }
示例#7
0
 public void Setup_FolderMissing_CreatesConfigurationFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path + @"\setupFolder");
         Assert.That(folder.SubFolderExists("setupFolder\\"+FileProvider.ConfigurationFolderName));
     }
 }
示例#8
0
 public void Setup_FolderExists_DoesNotCreateFolder()
 {
     using (var folder = new TempFolderAdapter())
     {
         target.SetupProject(folder.Path);
         Assert.That(folder.SubFolderExists(folder.Name),Is.False);
     }
 }
示例#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>());
            }
        }
示例#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"));
         }
     }
 }
示例#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);
         }
     }
 }