Skip to content

Commit edf29f1

Browse files
authored
Update README.md (#156)
1 parent b3eead8 commit edf29f1

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

README.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
# Ensure.That
2-
Ensure.That is a simple guard clause argument validation lib, that helps you with validation of your arguments.
3-
4-
It's developed for .NET 4.5.2 as well as .NET Standard 1.1 and .NET Standard 2.0 and available via [NuGet](https://www.nuget.org/packages/ensure.that/).
5-
6-
[![Build Status](https://dev.azure.com/daniel-wertheim/os/_apis/build/status/Ensure.That-CI?branchName=master)](https://dev.azure.com/daniel-wertheim/os/_build/latest?definitionId=1&branchName=master)
7-
[![NuGet](https://img.shields.io/nuget/v/ensure.that.svg)](http://nuget.org/packages/ensure.that)
8-
9-
## Using extension methods
10-
This was supposed to be removed but after some wishes from the community it has been kept it with some slight changes.
11-
12-
If you are worried that the constructed `public struct Param<T> {}` created for the argument being validated will hurt your performance you can use any of the other constructs e.g. contextual `Ensure.String` or `EnsureArg`.
13-
14-
```csharp
15-
Ensure.That(myString).IsNotNullOrWhiteSpace();
16-
Ensure.That(myString, nameof(myArg)).IsNotNullOrWhiteSpace();
17-
Ensure.That(myString, nameof(myArg), opts => opts.WithMessage("Foo")).IsNotNullOrWhiteSpace();
18-
```
19-
20-
## Using contextual validation
21-
This flavour was introduced in the `v7.0.0` release.
22-
23-
```csharp
24-
Ensure.String.IsNotNullOrWhiteSpace(myString);
25-
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg));
26-
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));
27-
```
28-
### Using static simple methods
29-
The `EnsureArg` flavour was added in the `v5.0.0` release.
30-
31-
```csharp
32-
EnsureArg.IsNotNullOrWhiteSpace(myString);
33-
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));
34-
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));
35-
```
36-
37-
## Samples
38-
The Samples above just uses `string` validation, but there are more. E.g.:
39-
40-
* Strings
41-
* Numerics
42-
* Collections (arrays, lists, collections, dictionaries)
43-
* Booleans
44-
* Guids
45-
46-
## Get up and running with the source code #
47-
The main solution is maintained using Visual Studio 2017.
48-
49-
Unit-tests are written using `xUnit` and there are no integration tests, hence you should just be able to:
50-
51-
- `Pull`
52-
- `Compile`
53-
- `Run the tests`
54-
55-
Easiest done using:
56-
57-
```
58-
git clone ...
59-
```
60-
61-
and
62-
63-
```
64-
dotnet test src/Ensure.That.sln
65-
```
1+
# Ensure.That
2+
Ensure.That is a simple guard clause argument validation lib, that helps you with validation of your arguments.
3+
4+
It's developed for .NET 4.5.1 as well as .NET Standard 1.1, 2.0, and 2.1 available via [NuGet](https://www.nuget.org/packages/ensure.that/).
5+
6+
[![Build Status](https://dev.azure.com/daniel-wertheim/os/_apis/build/status/Ensure.That-CI?branchName=master)](https://dev.azure.com/daniel-wertheim/os/_build/latest?definitionId=1&branchName=master)
7+
[![NuGet](https://img.shields.io/nuget/v/ensure.that.svg)](http://nuget.org/packages/ensure.that)
8+
9+
## Using extension methods
10+
This was supposed to be removed but after some wishes from the community it has been kept it with some slight changes.
11+
12+
If you are worried that the constructed `public struct Param<T> {}` created for the argument being validated will hurt your performance you can use any of the other constructs e.g. contextual `Ensure.String` or `EnsureArg`.
13+
14+
```csharp
15+
Ensure.That(myString).IsNotNullOrWhiteSpace();
16+
Ensure.That(myString, nameof(myArg)).IsNotNullOrWhiteSpace();
17+
Ensure.That(myString, nameof(myArg), opts => opts.WithMessage("Foo")).IsNotNullOrWhiteSpace();
18+
```
19+
20+
## Using contextual validation
21+
This flavour was introduced in the `v7.0.0` release.
22+
23+
```csharp
24+
Ensure.String.IsNotNullOrWhiteSpace(myString);
25+
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg));
26+
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));
27+
```
28+
### Using static simple methods
29+
The `EnsureArg` flavour was added in the `v5.0.0` release.
30+
31+
```csharp
32+
EnsureArg.IsNotNullOrWhiteSpace(myString);
33+
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));
34+
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));
35+
```
36+
37+
## Samples
38+
The Samples above just uses `string` validation, but there are more. E.g.:
39+
40+
* Strings
41+
* Numerics
42+
* Collections (arrays, lists, collections, dictionaries)
43+
* Booleans
44+
* Guids
45+
46+
## Get up and running with the source code #
47+
The main solution is maintained using Visual Studio 2017.
48+
49+
Unit-tests are written using `xUnit` and there are no integration tests, hence you should just be able to:
50+
51+
- `Pull`
52+
- `Compile`
53+
- `Run the tests`
54+
55+
Easiest done using:
56+
57+
```
58+
git clone ...
59+
```
60+
61+
and
62+
63+
```
64+
dotnet test src/Ensure.That.sln
65+
```

0 commit comments

Comments
 (0)