コード例 #1
0
        public void ShouldSaveTagsIntoDatabase()
        {
            //Arrange
            UrlService urlService = new UrlService(urlRepository);

            //Act
            urlService.AddUrlDictionary(urlDictionary);
            //Assert
            urlRepository.Received(2).AddUrlEntity(Arg.Any <UrlEntity>());
            urlRepository.Received(1).GetAllUrls();
        }
コード例 #2
0
        public async Task GetUrls(string userInput, int maxIterations)
        {
            Stopwatch watch = new Stopwatch();

            Console.WriteLine($"{DateTime.Now} Start url parsing");
            watch.Start();
            var urlsDictionary = await parallelUrlCollectingService.GetUrls(userInput, maxIterations);

            watch.Stop();
            Console.WriteLine($"{DateTime.Now} Parsing with derph {maxIterations} is completed in {watch.Elapsed}");
            Console.WriteLine($"{DateTime.Now} Start save url to database");
            watch.Restart();
            urlService.AddUrlDictionary(urlsDictionary);
            watch.Stop();
            Console.WriteLine($"{DateTime.Now} Saving to database is completed in {watch.Elapsed}");
        }