示例#1
0
        public async Task <IViewComponentResult> InvokeAsync(int currentCategoryId, int currentProductId)
        {
            if (!_blogSettings.Enabled)
            {
                return(Content(""));
            }

            var model = await _blogModelFactory.PrepareBlogPostYearModelAsync();

            return(View(model));
        }
示例#2
0
        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);
        }