public void GetSubFolders_CacheOnDiskExistsAndIsNotUpToDateAndFileSystemUpdatedWhileParsing_ParsedItemsReturnedAfterParsingContainUpdate()
        {
            FileSystemParserWithAction parser = new FileSystemParserWithAction(new FileSystemListener(), new List <string> {
                FolderName
            });

            parser.Action = (() => Directory.CreateDirectory(FolderName + "\\Temp2"));
            parser.DelayInMilliseconds = 200;
            _asyncParser = new AsyncFileSystemParser(parser, 0);

            SetUpInactiveCache();

            _fileSystemParser.Action = (() => Directory.CreateDirectory(FolderName + "\\Temp2"));
            CreateCachedParser();

            //To wait for folder creation
            Thread.Sleep(400);
            List <FileSystemItem> subfolders = _cachedFileSystemParser.GetSubFolders();

            List <string> expectedSubfolderNames = new List <string> {
                "Folder", "Temp", "Temp2"
            };

            Assert.That(GetFileSystemItemNames(subfolders), Is.EquivalentTo(expectedSubfolderNames));
        }
        public void SetUp()
        {
            _listener   = new FileSystemListener();
            _serializer = new CacheSerializer(TempFileName);
            //Don't use the same listener for parser and cached file parser, as they will operate on different threads
            _fileSystemParser = new FileSystemParserWithAction(new FileSystemListener(), new List <string> {
                FolderName
            });
            _registryService = new FakeRegistryService();
            _asyncParser     = new AsyncFileSystemParser(new FileSystemParser(new FileSystemListener(), new List <string> {
                FolderName
            }));
            _appRunOnStartup     = true;
            _updatesCountToWrite = -1;

            DirectoryUtility.EnsureClearFolder(FolderName);

            if (Directory.Exists(FolderName))
            {
                DeleteFolder();
            }
            Directory.CreateDirectory(FolderName);
        }