Exemplo n.º 1
0
 public void AddFile_AddsFile()
 {
     ILogger logger = new InMemoryLogger();
       var jsonFileRepository = new JsonFileRepository(sampleJsonFile, logger);
       jsonFileRepository.Add(new File() {
     CreatedTime = DateTime.Now.AddDays(-1),
     FolderId = 0,
     IsReadOnly = true,
     LastAccessTime = DateTime.Now,
     LastWriteTime = DateTime.Now,
     Name = "Test.txt",
     Path = System.Environment.CurrentDirectory,
     Size = 1024
       });
       File file = jsonFileRepository.GetAllFiles().Single();
       Assert.Equal("Test.txt", file.Name);
 }
Exemplo n.º 2
0
 public void AddFiles_AddsFiles()
 {
     ILogger logger = new InMemoryLogger();
       var jsonFileRespository = new JsonFileRepository(sampleJsonFile, logger);
       List<File> files = new List<File>();
       for (int i = 0; i < 10; i++) {
     files.Add(new File() {
       CreatedTime = DateTime.Now.AddDays(-1),
       FolderId = 0,
       IsReadOnly = true,
       LastAccessTime = DateTime.Now,
       LastWriteTime = DateTime.Now,
       Name = "Test" + i + ".txt",
       Path = System.Environment.CurrentDirectory,
       Size = 1024
     });
       }
       jsonFileRespository.Add(files);
       Assert.Equal(files.Count, jsonFileRespository.GetAllFiles().Count());
 }
Exemplo n.º 3
0
        public void GetAllFiles_ShouldGetAllFiles()
        {
            ILogger logger = new InMemoryLogger();
              var jsonFileRepository = new JsonFileRepository(sampleJsonFile, logger);
              int numberOfFilesToAdd = 10;

              for (int i = 0; i < numberOfFilesToAdd; i++) {
            jsonFileRepository.Add(new File() {
              CreatedTime = DateTime.Now.AddDays(-1),
              FolderId = 0,
              IsReadOnly = true,
              LastAccessTime = DateTime.Now,
              LastWriteTime = DateTime.Now,
              Name = "Test" + i + ".txt",
              Path = System.Environment.CurrentDirectory,
              Size = 1024
            });
              }

              var allFiles = jsonFileRepository.GetAllFiles();
              Assert.Equal(numberOfFilesToAdd, allFiles.Count());
        }