Esempio n. 1
0
 private async Task RemoveRecentFilesAction(IEnumerable <string> files)
 {
     foreach (string file in files)
     {
         ActiveFile activeFile = _fileSystemState.FindActiveFileFromEncryptedPath(file);
         if (activeFile != null)
         {
             _fileSystemState.RemoveActiveFile(activeFile);
         }
     }
     await _fileSystemState.Save();
 }
        public void TestArgumentNull()
        {
            using (FileSystemState state = new FileSystemState())
            {
                ActiveFile nullActiveFile = null;
                string     nullPath       = null;
                Func <ActiveFile, Task <ActiveFile> > nullAction = null;
                IDataStore nullFileInfo = null;

                Assert.Throws <ArgumentNullException>(() => { state.RemoveActiveFile(nullActiveFile); });
                Assert.Throws <ArgumentNullException>(() => { state.Add(nullActiveFile); });
                Assert.Throws <ArgumentNullException>(() => { state.FindActiveFileFromEncryptedPath(nullPath); });
                Assert.ThrowsAsync <ArgumentNullException>(async() => { await state.ForEach(nullAction); });
                Assert.Throws <ArgumentNullException>(() => { FileSystemState.Create(nullFileInfo); });
            }
        }