HyperDev.Tests
1.2.1
dotnet add package HyperDev.Tests --version 1.2.1
NuGet\Install-Package HyperDev.Tests -Version 1.2.1
<PackageReference Include="HyperDev.Tests" Version="1.2.1" />
<PackageVersion Include="HyperDev.Tests" Version="1.2.1" />
<PackageReference Include="HyperDev.Tests" />
paket add HyperDev.Tests --version 1.2.1
#r "nuget: HyperDev.Tests, 1.2.1"
#:package HyperDev.Tests@1.2.1
#addin nuget:?package=HyperDev.Tests&version=1.2.1
#tool nuget:?package=HyperDev.Tests&version=1.2.1
HyperDev.Tests
Test helpers for applications built on the HyperDev Fatum framework. Provides mocks of the framework services to write unit and integration tests, typically against an in-memory SQLite database.
ConnectionManagerMock: anIConnectionManagerthat resolves connections through an event or a dictionary of aliasesDataContextFactoryMock: aDataContextFactorythat opens the connection and creates the database schema for every new contextAddConnectionManagerandAddDataContextFactoryextensions onServiceCollectionto register both mocks (by default the database is deleted and recreated for each context)AppSettingsMock: anAppSettingswhose values can be set from the test, with optional fallback to anotherIAppSettingsResourceManagerMock: overrides single entries of a generated.resxresource class, injected withResourceManagerMock.Inject(typeof(Resources))
Installation
dotnet add package HyperDev.Tests
Quick start
using HyperDev.Data;
using HyperDev.Data.Sqlite;
using HyperDev.Tests.Data;
using Microsoft.Extensions.DependencyInjection;
DatabaseProviderFactories.Register(SqliteProvider.Instance);
var services = new ServiceCollection();
var connections = services.AddConnectionManager(e =>
e.ConnectionInfo = new SqliteConnectionInfo("Data Source=:memory:"));
var factory = services.AddDataContextFactory(connections);
// OrdersContext is a DataContext of the application under test
using var context = factory.CreateContext<OrdersContext>("Orders");
Settings for the code under test:
using HyperDev.Tests;
var settings = new AppSettingsMock();
settings.Values["PageSize"] = "50";
int pageSize = settings.Get<int>("PageSize"); // 50
Target frameworks
.NET 8.0, .NET 10.0
License
MIT, © Ivan Senatore, Wemake Informatica srl. Third-party dependencies keep their own licenses (Microsoft.EntityFrameworkCore., Microsoft.Data.Sqlite, Microsoft.Extensions., System.Resources.ResourceManager: MIT, SQLitePCLRaw: Apache-2.0).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- HyperDev.Core (>= 1.2.4)
- HyperDev.Data (>= 1.2.2)
- HyperDev.Data.Sqlite (>= 1.2.1)
-
net8.0
- HyperDev.Core (>= 1.2.4)
- HyperDev.Data (>= 1.2.2)
- HyperDev.Data.Sqlite (>= 1.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.