mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-22 07:06:20 +08:00
29 lines
707 B
C#
29 lines
707 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using AutoBogus;
|
|
using Util.Tests.Models;
|
|
|
|
namespace Util.Tests.Fakes;
|
|
|
|
/// <summary>
|
|
/// 贴子模拟数据服务
|
|
/// </summary>
|
|
public static class PostFakeService {
|
|
/// <summary>
|
|
/// 获取贴子
|
|
/// </summary>
|
|
public static Post GetPost() {
|
|
return GetPosts( 1 ).First();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取贴子列表
|
|
/// </summary>
|
|
/// <param name="count">行数</param>
|
|
public static List<Post> GetPosts( int count ) {
|
|
return new AutoFaker<Post>()
|
|
.Ignore( t => t.Tags )
|
|
.RuleFor( t => t.IsDeleted, false )
|
|
.Generate( count );
|
|
}
|
|
} |