tests/DotNetCommon.Test/Data/TreeTests.cs

(开头部分) 37KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using DotNetCommon.Data;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetCommon.Extensions;
using Shouldly;

namespace DotNetCommon.Test.Data
{
    [TestFixture]
    public class TreeTests
    {
        #region 模型
        public class Area
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public int? PId { get; set; }
            public List<Area> Children { get; set; }
        }

        public class Area2 : ITreeStruct<Area2>
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public int? PId { get; set; }
            public List<Area2> Children { get; set; }
        }

        public class Area3
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public int? PId { get; set; }
        }
        #endregion

        #region ToTree
        /// <summary>
        /// FetchToTree/ToTree
        /// </summary>
        [Test]
        public void TestToTree()
        {
            /*
            中国
                河南
                    郑州
                        中原区
                        金水区
                    洛阳
                        西工区
                湖北
                    武汉
                    十堰
                山东
            美国
                华盛顿州
后面还有 880 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。