public void SetupFiles() { if (Directory.Exists(FileStatics.RootPath)) { CopyFolder(FileStatics.RootPath, backupPath); } if (!Directory.Exists(FileStatics.TempPath)) { Directory.CreateDirectory(FileStatics.TempPath); } Database.Initialize(); Database.Clear(); FileStorage.Clear(); }
public void SetUp() { if (Directory.Exists(FileStatics.RootPath)) { CopyFolder(FileStatics.RootPath, backupPath); } Database.Initialize(); Database.Clear(); FileStorage.Clear(); DirectoryInfo dir = new DirectoryInfo(tempPath); if (Directory.Exists(tempPath)) { dir.Delete(true); } dir.Create(); }
static async Task Main(string[] args) { var running = true; var startUri = new Uri("https://tretton37.com"); var browser = new HttpBrowser(); var storage = new FileStorage(new Uri(Environment.CurrentDirectory + "/downloaded/")); var crawler = new Crawler(browser, storage); var session = crawler.CreateSession(startUri); Console.WriteLine("Press any key to start crawling..."); Console.ReadKey(); Console.Clear(); _ = Task.Run(() => { while (running) { Console.SetCursorPosition(0, 0); Console.WriteLine($"Currently downloading: {session.Downloading.Count()} "); Console.WriteLine($"Completed: {session.Completed.Count()} "); Task.Delay(500); } }); await storage.Clear(); await session.Crawl(); running = false; Console.WriteLine(); Console.WriteLine("Crawl finished succesfully. Press any key to exit..."); Console.ReadKey(); }
public void Add_User_Storage_File_Tests_Method() { fileStorage.Clear(); var date = DateTimeOffset.Now; var guid = Guid.NewGuid(); UserItem userItem = new UserItem() { ChatId = 123, DateOfRegistration = date, FirstName = "Null", Id = guid, Message = "Null", Status = StatusEnum.Null }; fileStorage.AddUser(userItem); Assert.AreEqual(fileStorage.Count, 1); fileStorage.Clear(); }