public async Task <IViewComponentResult> InvokeAsync(int currentCategoryId, int currentProductId) { if (!_blogSettings.Enabled) { return(Content("")); } var model = await _blogModelFactory.PrepareBlogPostYearModelAsync(); return(View(model)); }
public async Task CanPrepareBlogPostYearModel() { var model = await _blogModelFactory.PrepareBlogPostYearModelAsync(); var date = DateTime.Now.ToUniversalTime(); model.Count.Should().Be(1); model[0].Year.Should().Be(date.Year); var months = model[0].Months; months.Count.Should().Be(1); var month = months.First(); month.BlogPostCount.Should().Be(2); month.Month.Should().Be(date.Month); }