JCoder.Mock4Net
2.8.2309.2801
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package JCoder.Mock4Net --version 2.8.2309.2801
NuGet\Install-Package JCoder.Mock4Net -Version 2.8.2309.2801
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JCoder.Mock4Net" Version="2.8.2309.2801" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JCoder.Mock4Net --version 2.8.2309.2801
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JCoder.Mock4Net, 2.8.2309.2801"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JCoder.Mock4Net as a Cake Addin #addin nuget:?package=JCoder.Mock4Net&version=2.8.2309.2801 // Install JCoder.Mock4Net as a Cake Tool #tool nuget:?package=JCoder.Mock4Net&version=2.8.2309.2801
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
JCoder.Mock4Net
| 属性 | | | --------------- | -------------------------------------------- | | 作者(Authors) | Jackie Law | | 版权(Copyright) | Copyright © Jackie Law. All rights reserved. | | 协议 | MIT | | 联系(QQ) | 1378071853 | | 联系(Wechat) | JackieLaw1024 | | 联系(Email) | JackieLaw-dev@outlook.com |
[TOC]
一.架构说明
JCoder.Mock4Net | |
---|---|
语言 | C# |
协议 | MIT |
.Net框架 | .Net Standard2.1; .Net Framework 4.7.2; .Net 7; .Net 6; |
简述 | A simple library for data mock.(一款简易版的用于模拟数据的功能库); |
1.1 引用类库
引用类库 | 版本 |
---|---|
- | - |
1.2 相关类库
| 相关类库 | 说明 | | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | JCoder.Db4Net | 一款为方便使用数据库的操作类库。 | | JCoder.Db4Net.Sqlite | 一个基于JCoder.Db4Net且支持Sqlite的库。 | | JCoder.Db4Net.MySql | 一个基于JCoder.Db4Net且支持Mysql的库。 | | JCoder.Db4Net.SqlServer | 一个基于JCoder.Db4Net且支持SqlServer的库 。 | | JCoder.Mock4Net | 一款简易版的用于模拟数据的功能库。 | | JCoder.Log4Net | 一款用于日志记录的类库。 | | JCoder.Log4Net.Sqlite | 一款使用Sqlite进行日志记录的类库。 | | JCoder.Ioc4Net | 一款简易款的Ioc操作类库。 | | JCoder.Extension | A simple library for C# extension.(一款简易的用于c#的扩展库。) |
获取方式
- 版本要求:>=2.5.1
- 以版本2.5.1为例
获取方式 | 描述 |
---|---|
Package Manager | Install-Package JCoder.Mock4Net -Version 2.5.1 |
.Net CLI | dotnet add package JCoder.Mock4Net --version 2.5.1 |
PackageReference | <PackageReference Include="JCoder.Mock4Net" Version="2.5.1" /> |
Paket CLI | paket add JCoder.Mock4Net --version 2.5.1 |
Script&Interactive | #r "nuget: JCoder.Mock4Net, 2.5.1" |
Cake | // Install JCoder.Mock4Net as a Cake Addin<br/>#addin nuget:?package=JCoder.Mock4Net&version=2.5.1<br/><br/>// Install JCoder.Mock4Net as a Cake Tool<br/>#tool nuget:?package=JCoder.Mock4Net&version=2.5.1 |
使用说明
生成随机值
生成随机数
Description | Code | Result |
---|---|---|
生成Int32,闭区间范围 | Mock.GenInt(-10, 10); | -10 To 10 |
生成Int32,右开区间 | Mock.GenIntWithRightOpen(-10, 10); | -10 To 9 |
生成Int32,全开区间 | Mock.GenIntWithOpen(-10, 10); | -9 To 9 |
生成double,闭区间范围 | Mock.GenDouble(-10.0, 10.0); | 3.1568602379730253 |
生成double(指定精度),闭区间范围 | Mock.GenDouble(-10.0, 10.0, 4); | 5.0024 |
生成随机文本
Description | Code | Result |
---|---|---|
生成10位长度随机组合的文本 | Mock.GenText("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+", 10); | dhC8EoP7pd |
生成15位长度不重复的随机组合的文本 | Mock.GenTextNoRepeat("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+", 15); | 1yADU3OhfCNY*PW |
生成15位长度以A-Za-z随机组合的文本 | Mock.GenTextEN(15); | RenoFLCfSWEzUYY |
生成15位长度以A-Z随机组合的文本 | Mock.GenTextEN(15); | INJXTSMQTURTJPI |
生成15位长度以a-z随机组合的文本 | Mock.GenTextEN(15); | fptxrwsrskfpkss |
生成15位长度以0-9随机组合的文本 | Mock.GenTextNumber(15); | 619582770751506 |
生成15位长度以16进制随机组合的文本 | Mock.GenTextHex(15); | 9111EA7917548FE |
生成20位长度随机组合的中文文本 | Mock.GenChineses(20); | 凳榔贞奋锥泞呆酷霜这蛙种烈姿嫉轿蓖瞪赏纺 |
生成随机中文 | Mock.GenChinese(); | 舟 |
生成随机电话号码
Description | Code | Result |
---|---|---|
生成以136开头的11位长度电话号码 | Mock.GenPhoneNumber(11, 136); | 13623010509 |
生成随机国家或地区编码
Description | Code | Result |
---|---|---|
生成国家或地区的2位字母代码 | Mock.GenTerritoryCode2(); | CH |
生成国家或地区的3位字母代码 | Mock.GenTerritoryCode3(); | USA |
生成国家或地区的3位数字代码 | Mock.GenTerritoryNumber(); | 583 |
生成国家或地区的中文名称 | Mock.GenTerritoryCN(); | 中国澳门 |
生成国家或地区的英文名称 | Mock.GenTerritoryEN(); | Yemen |
生成随机名称
Description | Code | Result |
---|---|---|
生成中文名称 | Mock.GenFullNameCN(); | 李小明 |
生成中文名称(单姓氏+双字名称) | Mock.GenFullNameCN(1,2); | 李小明 |
生成中文名称(复姓氏+单字名称) | Mock.GenFullNameCN(2,1); | 欧阳空 |
生成英文名称 | Mock.GenFullNameEN(); | Seteyski Steau |
生成英文名称(单姓+不限定长度) | Mock.GenFullNameEN(1, -1); | Seadaez Smouski Sheethu |
实例使用
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- System.Text.Encoding.CodePages (>= 6.0.0)
-
.NETStandard 2.1
- System.Text.Encoding.CodePages (>= 6.0.0)
-
net6.0
- System.Text.Encoding.CodePages (>= 6.0.0)
-
net7.0
- System.Text.Encoding.CodePages (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.8.2309.2801 | 258 | 9/27/2023 |
2.7.2308.315 | 182 | 8/3/2023 |
2.6.2 | 329 | 1/4/2023 |
2.6.1 | 280 | 12/12/2022 |
2.5.1 | 443 | 3/31/2022 |
2.4.1 | 406 | 3/19/2022 |
2.3.2 | 434 | 3/14/2022 |
Please contact Jackie by QQ 1378071853 or E-mail JackieLaw-dev@outlook.com;