C# Класс CAESDO.Recruitment.Core.Utils.Check

Design By Contract Checks. Each method generates an exception or a trace assertion statement if the contract is broken.
This example shows how to call the Require method. public void Test(int x) { try { Check.Require(x > 1, "x must be > 1"); } catch (System.Exception ex) { Console.WriteLine(ex.ToString()); } } You can direct output to a Trace listener. For example, you could insert Trace.Listeners.Clear(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); or direct output to a file or the Event Log. (Note: For ASP.NET clients use the Listeners collection of the Debug, not the Trace, object and, for a Release build, only exception-handling is possible.)
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
Check System

Открытые методы

Метод Описание
Assert ( bool assertion ) : void

Assertion check.

Assert ( bool assertion, string message ) : void

Assertion check.

Assert ( bool assertion, string message, Exception inner ) : void

Assertion check.

Ensure ( bool assertion ) : void

Postcondition check.

Ensure ( bool assertion, string message ) : void

Postcondition check.

Ensure ( bool assertion, string message, Exception inner ) : void

Postcondition check.

Invariant ( bool assertion ) : void

Invariant check.

Invariant ( bool assertion, string message ) : void

Invariant check.

Invariant ( bool assertion, string message, Exception inner ) : void

Invariant check.

Require ( bool assertion ) : void

Precondition check - should run regardless of preprocessor directives.

Require ( bool assertion, string message ) : void

Precondition check - should run regardless of preprocessor directives.

Require ( bool assertion, string message, Exception inner ) : void

Precondition check - should run regardless of preprocessor directives.

Приватные методы

Метод Описание
Check ( ) : System

Описание методов

Assert() публичный статический Метод

Assertion check.
public static Assert ( bool assertion ) : void
assertion bool
Результат void

Assert() публичный статический Метод

Assertion check.
public static Assert ( bool assertion, string message ) : void
assertion bool
message string
Результат void

Assert() публичный статический Метод

Assertion check.
public static Assert ( bool assertion, string message, Exception inner ) : void
assertion bool
message string
inner System.Exception
Результат void

Ensure() публичный статический Метод

Postcondition check.
public static Ensure ( bool assertion ) : void
assertion bool
Результат void

Ensure() публичный статический Метод

Postcondition check.
public static Ensure ( bool assertion, string message ) : void
assertion bool
message string
Результат void

Ensure() публичный статический Метод

Postcondition check.
public static Ensure ( bool assertion, string message, Exception inner ) : void
assertion bool
message string
inner System.Exception
Результат void

Invariant() публичный статический Метод

Invariant check.
public static Invariant ( bool assertion ) : void
assertion bool
Результат void

Invariant() публичный статический Метод

Invariant check.
public static Invariant ( bool assertion, string message ) : void
assertion bool
message string
Результат void

Invariant() публичный статический Метод

Invariant check.
public static Invariant ( bool assertion, string message, Exception inner ) : void
assertion bool
message string
inner System.Exception
Результат void

Require() публичный статический Метод

Precondition check - should run regardless of preprocessor directives.
public static Require ( bool assertion ) : void
assertion bool
Результат void

Require() публичный статический Метод

Precondition check - should run regardless of preprocessor directives.
public static Require ( bool assertion, string message ) : void
assertion bool
message string
Результат void

Require() публичный статический Метод

Precondition check - should run regardless of preprocessor directives.
public static Require ( bool assertion, string message, Exception inner ) : void
assertion bool
message string
inner System.Exception
Результат void