Previous Docs Version

The documentation you are viewing is for a previous version of the Vendr product. Click here to jump to the current stable version.

AssertionExtensions

API reference for AssertionExtensions in Vendr, the eCommerce solution for Umbraco v8+

AssertionExtensions

Extension methods for performing assertions

public static class AssertionExtensions

Namespace

Methods

MustContainKey

Asserts that a key must be present in a dictionary, and that it's value must not be null or empty

public static void MustContainKey(this IDictionary<string, string> dictionary, string key, 
    string paramName)

Parameters

Parameter Description
dictionary
The dictionary to check
key
The key to look for
paramName
A friendly parameter name to display in the assertion exception if the assertion fails

Exceptions

Exception Condition
ArgumentException
Thrown if the given key is not present in the dictionary, or if it's value is null or empty

MustNotBeNull<T>

Asserts that a parameter must not be null

public static void MustNotBeNull<T>(this T param, string paramName)
    where T : class

Parameters

Parameter Description
T
The Type of the parameter
param
The parameter to check
paramName
A friendly parameter name to display in the assertion exception if the assertion fails

Exceptions

Exception Condition
ArgumentNullException
Thrown if the given parameter is null

MustNotBeNullOrEmpty

Asserts that a parameter must not be null or empty

public static void MustNotBeNullOrEmpty(this string param, string paramName)

Parameters

Parameter Description
param
The parameter to check
paramName
A friendly parameter name to display in the assertion exception if the assertion fails

Exceptions

Exception Condition
ArgumentException
Thrown if the given parameter is null or empty

MustNotBeNullOrWhiteSpace

Asserts that a parameter must not be null or white space

public static void MustNotBeNullOrWhiteSpace(this string param, string paramName)

Parameters

Parameter Description
param
The parameter to check
paramName
A friendly parameter name to display in the assertion exception if the assertion fails

Exceptions

Exception Condition
ArgumentException
Thrown if the given parameter is null or white space

Edit this page on GitHub

Site + logo design © 2024 Outfield Digital Ltd. Content contributions licensed under MIT.
Vendr® is a Registered Trademark of Outfield Digital Ltd.