Idrek / XUnit.Assertions.Ref

Reference of XUnit assertions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xunit assertions

Commit: c27a91f8cbcee37cb45699a3a81287bca225e876

Summary

Boolean asserts
Collection asserts
Equality asserts
Equivalence asserts
Event asserts
Exception asserts
Fail asserts
Identity asserts
Multiple asserts
Null asserts
Property asserts
Range asserts
Set asserts
Skip asserts
String/Span/Memory asserts
Regex asserts
Type asserts


Boolean asserts

Assert.True(expression)

Assert.False(expression)

Collection asserts

Assert.All<T>(collection, predicate)

Assert.All(collection, predicate)

Assert.AllAsync<T>(collection, predicate)

Assert.AllAsync(collection, predicate)

Assert.Collection(collection)

Assert.Collection(collection, predicate1, ..., predicateN)

Assert.CollectionAsync(collection)

Assert.CollectionAsync(collection, predicate1, ..., predicateN)

Assert.Contains(element, collection)

Assert.Contains(element, collection, comparer)

Assert.Contains(collection, predicate)

Assert.Contains<T>(collection, predicate)

Assert.Distinct(collection)

Assert.Distinct<T>(collection)

Assert.Distinct(collection, comparer)

Assert.DoesNotContain(element, collection)

Assert.DoesNotContain(element, collection, comparer)

Assert.DoesNotContain(collection, predicate)

Assert.Empty(collection)

Assert.NotEmpty(collection)

Assert.Single(collection)

Assert.Single<T>(collection)

Assert.Single(collection, element)

Assert.Single(collection, predicate)

Assert.Single<T>(collection, predicate)

Equality asserts

Assert.Equal(expected, actual)

Assert.Equal<T>(expected, actual)

Assert.Equal(expected, actual, comparer)

Assert.Equal(expected, actual, precision)

Assert.Equal(expected, actual, precision, MidpointRounding)

Assert.Equal(expected, actual, tolerance)

Assert.StrictEqual(expected, actual)

Assert.NotEqual(expected, actual)

Assert.NotEqual(expected, actual, comparer)

Assert.NotEqual(expected, actual, precision)

Assert.NotStrictEqual(expected, actual)

Equivalence asserts

Assert.Equivalent(expected, actual)

Assert.Equivalent(expected, actual, strict: boolean)

Event asserts

Assert.Raises<T>(predicate1, predicate2, predicate3)

Assert.RaisesAny<T>(predicate1, predicate2, predicate3)

Assert.RaisesAsync<T>(predicate1, predicate2, predicate3)

Assert.RaisesAnyAsync<T>(predicate1, predicate2, predicate3)

Exception asserts

Assert.Throws<E>(predicate)

Assert.Throws(exceptionType, predicate)

Assert.Throws<E>(paramName, predicate)

Assert.ThrowsAsync<E>(predicate)

Assert.ThrowsAsync(exceptionType, predicate)

Assert.ThrowsAsync<E>(paramName, predicate)

Assert.ThrowsAny<E>(predicate)

Assert.ThrowsAnyAsync<E>(predicate)

Fail asserts

Assert.Fail(message)

Identity asserts

Assert.Same(expected, actual)

Assert.NotSame(expected, actual)

Multiple asserts

Assert.Multiple()

Assert.Multiple(predicate1, ..., predicateN)

Null asserts

Assert.Null(expression)

Assert.NotNull(expression)

Property asserts

Assert.PropertyChanged(element, property, predicate)

Assert.PropertyChangedAsync(element, property, predicate)

Range asserts

Assert.InRange(value, minRange, maxRange)

Assert.InRange(value, minRange, maxRange, comparer)

Assert.NotInRange(value, minRange, maxRange)

Assert.NotInRange(value, minRange, maxRange, comparer)

Set asserts

Assert.Subset(expected, actual)

Assert.ProperSubset(expected, actual)

Assert.Superset(expected, actual)

Assert.ProperSuperset(expected, actual)

Skip asserts

Assert.Skip(testExpression)

Assert.SkipUnless(boolExpression, testExpression)

Assert.SkipWhen(boolExpression, testExpression)

String/Span/Memory asserts

Assert.StartsWith(search, text)

Assert.StartsWith(search, text, comparison)

Assert.EndsWith(search, text)

Assert.EndsWith(search, text, comparison)

Regex asserts

Assert.Matches(match, text)

Assert.DoesNotMatch(match, text)

Type asserts

Assert.IsAssignableFrom(type, expression)

Assert.IsAssignableFrom<T>(expression)

Assert.IsNotType(type, expression)

Assert.IsNotType<T>(expression)

Assert.IsType(type, expression)

Assert.IsType<T>(expression)

About

Reference of XUnit assertions