A .NET library providing defensive programming utilities (Guard clauses) and automated testing helpers for constructor null checks. Integrates with MSTest, AutoFixture, and NSubstitute for robust test automation.
$ dotnet add package Selkie.DefCon.OneA .NET library providing defensive programming utilities and testing helpers for building robust applications.
Install via NuGet Package Manager:
dotnet add package Selkie.DefCon.One
Or via Package Manager Console:
Install-Package Selkie.DefCon.One
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...
}
}
using Selkie.DefCon.One.Constructor;
[TestClass]
public class MyServiceTests
{
[TestMethod]
public void Constructor_Should_ThrowForNullParameters()
{
var sut = new NotNullTester<MyService>();
sut.RunAllNotNullChecks();
}
}Clone the repository:
git clone https://github.com/tschroedter/Selkie.DefCon.git
cd Selkie.DefCon
Restore dependencies:
cd src
dotnet restore
Build the solution:
dotnet build
Run tests:
dotnet test
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.
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.