网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
using Dpz.Core.Public.ViewModel;
using Dpz.Core.Service.RepositoryService;
using Dpz.Core.Service.RepositoryServiceImpl;
using NUnit.Framework;

namespace Dpz.Core.ServiceTest;

[TestFixture]
public class PageMetadataServiceTest : Basic
{

    [Test]
    public async Task SavePageMetadataTest()
    {
        IPageMetadataService service = new PageMetadataService(PageMetadataRepository, Mapper);
        var pageMetadata = new VmPageMetadata
        {
            Description = "the index description",
            Keywords = new List<string>
            {
               "article","news","blog"
            },
            Metas = new Dictionary<string, string>
            {
                { "author", "pengqian" },
                { "revised", $"apang ,{DateTime.Now}" }
            },
            Relations = new List<string>
            {
                "Article","Index"
            }
        };
        await service.SavePageMetadataAsync(pageMetadata);

        var dbPageMetadata = await service.GetPageMetadataAsync(pageMetadata.Relations);
        Assert.IsNotNull(dbPageMetadata);

        Console.WriteLine(JsonSerializer.Serialize(dbPageMetadata,new JsonSerializerOptions{WriteIndented = true}));
    }
}
loading