. NET Test Assertion Tool shouldly

Source: Internet
Author: User

. NET Test assertion Tool Shouldly.net test

shouldly Open Source address on GitHub: https://github.com/shouldly/shouldly
Shouldly's Official document: http://docs.shouldly-lib.net/
The Shouldly assertion Framework provides support for many aspects such as equality, iterations, dynamic variables, strings, dictionaries, Task/async, and exceptions.

Equality equal one of them

Shouldbeoneof
Shouldnotbeoneof

Greater than

Shouldbegreaterthan

Less than

Shouldbelessthan

Type

Shouldbeoftype

Can type conversions

Shouldbeassignableto

In a range

Shouldbeinrange
Shouldnotbeinrange

Enumeration collection starts with an object

Shouldstartwith

All elements in the collection meet the criteria

Shouldallbe

The collection contains an object

Shouldcontain
Shouldnotcontain

The collection contains elements that satisfy the condition

Shouldcontain (predicate)
Shouldnotcontain (predicate)

An empty collection for a collection

Shouldbeempty
Shouldnotbeempty

is one of them in the collection

Shouldbeoneof

is a subset of the collection object

Shouldbesubsetof

String contains keywords

Shouldcontainkey

String start and End

Shouldstartwith
Shouldnotstartwith
Shouldendwith
Shouldnotendwith

String contains

Shouldcontain
Shouldnotcontain
(Contains spaces)
Shouldcontainwithoutwhitespace

Match Regular expression

Shouldmatch

is an empty string or null

Shouldbenullorempty
Shouldnotbenullorempty

Dictionary contains key

Shouldnotcontainkey

Contains key and value

Shouldcontainkeyandvalue
Shouldnotcontainvalueforkey

Exception Throw exception

Shouldthrow
Shouldnotthrow
Shouldnotthrow (func<task>)

Asynchronous and synchronous throw exceptions

Shouldthrow

Owning property

Shouldhaveproperty

Complete

Completein

Dynamically meets all conditions

parameter is all assertions, all assertions are detected, and hints are given
Shouldsatisfyallconditions

. NET Test Assertion Tool shouldly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.