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
                    
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="Selkie.DefCon.One" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Selkie.DefCon.One" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Selkie.DefCon.One" />
                    
Project file
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 Selkie.DefCon.One --version 0.2.0
                    
#r "nuget: Selkie.DefCon.One, 0.2.0"
                    
#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 Selkie.DefCon.One@0.2.0
                    
#: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=Selkie.DefCon.One&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Selkie.DefCon.One&version=0.2.0
                    
Install as a Cake Tool

Selkie.DefCon

.NET Build and Test Dependabot Updates License: MIT

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

  1. Clone the repository:

    git clone https://github.com/tschroedter/Selkie.DefCon.git
    cd Selkie.DefCon
    
  2. Restore dependencies:

    cd src
    dotnet restore
    
  3. Build the solution:

    dotnet build
    
  4. Run 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

Support

If you encounter any issues or have questions, please open an issue on GitHub.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
0.2.0 274 11/6/2025
0.1.29 459 12/10/2025
0.1.28 450 12/10/2025
0.1.27 454 12/10/2025
0.1.5 239 10/22/2025
0.1.0 212 10/21/2025
0.0.23 514 5/30/2025
0.0.22 180 1/20/2025
0.0.17 879 9/30/2020
0.0.15 649 9/23/2020