private Statistic GetStatistic(_Command command) { var pathCommand = $"{command.ExecutedCommand} {command.Args}"; var commits = powerShellExecutor.Execute(pathCommand, statsCommand); var statisticParser = new StatisticParser(commits); return(statisticParser.Parse()); }
public async Task ExecuteAsync(ImageEntity imageEntity, ImageContext context, CancellationToken ct) { var request = new ImageByUrlRequest(context.User.Cookies, context.CurrentImageUrl); var parser = new StatisticParser(); var response = await Gate.SendAsync <ImageByUrlRequest, StatisticModel, StatisticParser>(request, parser); await _repository.AddOrUpdateAsync(CreateStatistic(response, imageEntity.Id), ct); }
public void StatisticParser(string page) { //Arrange const int expectedViews = 106; const int expectedComments = 0; const int expectedFavorites = 7; var parser = new StatisticParser(); var text = File.ReadAllText(page); //Act var actual = parser.Parse(text); //Assert Assert.Equal(expectedViews, actual.Views); Assert.Equal(expectedComments, actual.Comments); Assert.Equal(expectedFavorites, actual.Favorites); }