Reo.Core.Testing.CodeGeneration
8.0.565
dotnet add package Reo.Core.Testing.CodeGeneration --version 8.0.565
NuGet\Install-Package Reo.Core.Testing.CodeGeneration -Version 8.0.565
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="Reo.Core.Testing.CodeGeneration" Version="8.0.565" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reo.Core.Testing.CodeGeneration" Version="8.0.565" />
<PackageReference Include="Reo.Core.Testing.CodeGeneration" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Reo.Core.Testing.CodeGeneration --version 8.0.565
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Reo.Core.Testing.CodeGeneration, 8.0.565"
#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.
#:package Reo.Core.Testing.CodeGeneration@8.0.565
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Reo.Core.Testing.CodeGeneration&version=8.0.565
#tool nuget:?package=Reo.Core.Testing.CodeGeneration&version=8.0.565
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Генератор тестовых билдеров для доменных моделей
Описание пакета
Reo.Core.Testing.CodeGeneration — это библиотека для генерации тестовых билдеров доменных моделей.
Основные компоненты
ITestingBuilderFor<TModel>Маркерный интерфейс для partial классов, которые используются для создания билдеров доменных моделей.TModel- тип доменной модели.
Требования
Установка
Используйте следующие команды для установки пакета:
# NuGet Package Manager
Install-Package Reo.Core.Testing.CodeGeneration
# .NET CLI
dotnet add package Reo.Core.Testing.CodeGeneration
Настройка
Создание класса тестового билдера
public partial class MyModelTestBuilder : ITestingBuilderFor<MyModel>;
Доменный класс:
public class MyModel
{
private MyModel(string? name)
{
Name = name;
}
public string? Name { get; set; }
public static MyModel Create(string? name)
{
var result = new MyModel(name);
return result;
}
}
Сгенерированный класс с методами:
public partial class MyModelTestBuilder
{
private string? Name { get; set; }
public MyModelTestBuilder WithName(string name)
{
Name = name;
return this;
}
public MyModelTestBuilder WithNameAsNull()
{
Name = null;
return this;
}
public MyModel CreateMyModel() => MyModel.Create(Name);
}
Написание теста:
public class MyModelTests
{
private readonly AutoMocker _mocker = new();
private readonly MyModelTestBuilder _builder;
public MyModelTests() => _builder = _mocker.Get<MyModelTestBuilder>();
[Fact(DisplayName = "Наименование может быть не задано")]
public void Test1()
{
// Arrange
_builder.WithNameAsNull();
// Act
var result = _builder.CreateMyModel();
// Assert
result.Name.Should()
.BeNull();
}
}
Лицензия
Reo.Core.Testing распространяется под лицензией MIT. См. файл LICENSE для деталей.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- JetBrains.Annotations (>= 2025.2.2)
- Reo.Core.CodeGenerator (>= 8.0.565)
- stbychkov.AutoLoggerMessage (>= 1.0.14)
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 |
|---|---|---|
| 8.0.565 | 276 | 9/19/2025 |
| 8.0.564 | 268 | 9/19/2025 |
| 8.0.563 | 264 | 9/19/2025 |
| 8.0.562 | 278 | 9/19/2025 |
| 8.0.561 | 333 | 9/16/2025 |
| 8.0.560 | 325 | 9/16/2025 |
| 8.0.559 | 331 | 9/16/2025 |
| 8.0.558 | 336 | 9/16/2025 |
| 8.0.557 | 292 | 9/15/2025 |
| 8.0.556 | 276 | 9/15/2025 |
| 6.0.565 | 258 | 9/19/2025 |
| 6.0.564 | 267 | 9/19/2025 |
| 6.0.563 | 268 | 9/19/2025 |
| 6.0.562 | 274 | 9/19/2025 |
| 6.0.561 | 328 | 9/16/2025 |
| 6.0.560 | 322 | 9/16/2025 |
| 6.0.559 | 328 | 9/16/2025 |
| 6.0.558 | 325 | 9/16/2025 |
| 6.0.557 | 269 | 9/15/2025 |
| 6.0.556 | 281 | 9/15/2025 |
Loading failed