Table of Contents

Class CMSAssert

Namespace
CMS.Tests
Assembly
CMS.Tests.dll

Custom assertions

public class CMSAssert
Inheritance
object
CMSAssert
Extension Methods

Constructors

CMSAssert()

public CMSAssert()

Methods

All(params Action[])

Execute multiple assertions

public static void All(params Action[] assertionsToRun)

Parameters

assertionsToRun Action[]

Assertions to be executed

ForEach<T>(IEnumerable<T>, Action<T>)

Asserts the given expression for each item in the given collection

public static void ForEach<T>(IEnumerable<T> items, Action<T> action)

Parameters

items IEnumerable<T>

Items to assert

action Action<T>

Assert action for the item

Type Parameters

T

InThreads(int, Action<int>)

Runs multiple actions in the given number of threads and reports all failed assertions and errors

[Obsolete("Method was not intended for public use and will be removed in the next version. Use custom assert instead.")]
public static IEnumerable<Thread> InThreads(int count, Action<int> action)

Parameters

count int

Threads count

action Action<int>

Thread action

Returns

IEnumerable<Thread>

PathEquals(string, string, bool)

Asserts whether two paths are equal

public static void PathEquals(string expected, string actual, bool normalizeExpectedPathDelimiters = true)

Parameters

expected string

Expected path

actual string

Current path

normalizeExpectedPathDelimiters bool

If true, all backslash symbols in expected are normalized to System.IO.Path.DirectorySeparatorChar

PropertyValuesEqual(object, object)

Asserts two objects by comparing their property values

public static void PropertyValuesEqual(object actual, object expected)

Parameters

actual object

Current object

expected object

Expected object

QueryEquals(WhereCondition, string, string)

Asserts whether two queries equal

public static void QueryEquals(WhereCondition current, string expected, string message = null)

Parameters

current WhereCondition

Current query

expected string

Expected query

message string

Optional error message

QueryEquals(string, string, string)

Asserts whether two queries equal

public static void QueryEquals(string current, string expected, string message = null)

Parameters

current string

Current query

expected string

Expected query

message string

Optional error message

TextEquals(string, string, string, TextNormalizationSettings)

Asserts whether two queries equal

public static void TextEquals(string current, string expected, string message = null, TextNormalizationSettings settings = null)

Parameters

current string

Current query

expected string

Expected query

message string

Optional error message

settings TextNormalizationSettings

Text normalization settings

WithMessage(string, Action)

Executes assertion and adds additional message if assertion fails

[Obsolete("Method was not intended for public use and will be removed in the next version. Use custom assert instead.")]
public static void WithMessage(string message, Action assertionToRun)

Parameters

message string

Extra message in case assertion fails

assertionToRun Action

Assertion to be executed