Selkie.DefCon.One
0.2.0
dotnet add package Selkie.DefCon.One --version 0.2.0
NuGet\Install-Package Selkie.DefCon.One -Version 0.2.0
<PackageReference Include="Selkie.DefCon.One" Version="0.2.0" />
<PackageVersion Include="Selkie.DefCon.One" Version="0.2.0" />
<PackageReference Include="Selkie.DefCon.One" />
paket add Selkie.DefCon.One --version 0.2.0
#r "nuget: Selkie.DefCon.One, 0.2.0"
#:package Selkie.DefCon.One@0.2.0
#addin nuget:?package=Selkie.DefCon.One&version=0.2.0
#tool nuget:?package=Selkie.DefCon.One&version=0.2.0
Selkie.DefCon
A .NET library providing defensive programming utilities and testing helpers for building robust applications.
Features
- Guard Clauses: Comprehensive set of guard methods to validate method arguments
- Constructor Testing: Automated testing utilities for constructor null checks using AutoFixture and NSubstitute
- MSTest Integration: Seamless integration with MSTest2 for automated testing
- Autofac Support: Built-in Autofac module for dependency injection
Installation
Install via NuGet Package Manager:
dotnet add package Selkie.DefCon.One
Or via Package Manager Console:
Install-Package Selkie.DefCon.One
Quick Start
Using Guard Clauses
using Selkie.DefCon.One.Common;
public class MyService
{
private readonly string _name;
public MyService(string name)
{
Guard.ArgumentNotNullOrEmpty(name, nameof(name));
_name = name;
}
public void ProcessValue(int value)
{
Guard.ArgumentNotNegative(value, nameof(value));
// Process value...
}
}
Constructor Testing
using Selkie.DefCon.One.Constructor;
[TestClass]
public class MyServiceTests
{
[TestMethod]
public void Constructor_Should_ThrowForNullParameters()
{
var sut = new NotNullTester<MyService>();
sut.RunAllNotNullChecks();
}
}
Requirements
- .NET 8.0 or higher
Building from Source
Clone the repository:
git clone https://github.com/tschroedter/Selkie.DefCon.git cd Selkie.DefConRestore dependencies:
cd src dotnet restoreBuild the solution:
dotnet buildRun tests:
dotnet test
Version Management
This project uses centralized version management. To update the version before building:
# On Linux/macOS
./update-version.sh 1.2.3
# On Windows
.\update-version.ps1 -Version "1.2.3"
For more information, see VERSION_MANAGEMENT.md.
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with AutoFixture
- Uses NSubstitute for test substitutes
- Dependency injection powered by Autofac
Support
If you encounter any issues or have questions, please open an issue on GitHub.
| 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 was computed. 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. |
-
net8.0
- Autofac (>= 8.4.0)
- AutoFixture (>= 4.18.1)
- AutoFixture.AutoNSubstitute (>= 4.18.1)
- JetBrains.Annotations (>= 2025.2.2)
- NSubstitute (>= 5.3.0)
- Selkie.DefCon.One.Common (>= 0.2.0)
- Serilog (>= 4.3.0)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Selkie.DefCon.One:
| Package | Downloads |
|---|---|
|
Selkie.DefCon.One.Test.Examples
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.