Skip to content

A small project to allow the articulation of code contracts in .NET languages

License

Notifications You must be signed in to change notification settings

jason-wilmans/miniContract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniContract

miniContract is an ultra light-weight library to express code contracts in .NET. It exists, because it's developers switched to Visual Studio 2017 and needed a simple solution to replace Code Contracts. It is extremely KISS. In fact it consists of merely five classes.

It is designed so that the stacktrace resulting from a contract violation contains only one line of miniContract.

It is also purposely very code centric, providing only a hand full of individual expressions.

At the moment, invariants are not supported, but they will be added in the future.

Examples of Usage

// free conditions
Precondition.Is(true);    
Precondition.Is(true, "Custom message");

// individual expressions
Precondition.NotNull(anObject);
Precondition.NotNull(anObject, "Custom message");
Precondition.NotDefault(42);
Precondition.NotDefault(true, "Custom message");    

For more usage examples, check the tests.

About

A small project to allow the articulation of code contracts in .NET languages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages