Exemplo n.º 1
0
 public static string RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind kind, string user, string condition, Exception inner)
 {
     FailureCount++;
     if (condition != null)
     {
         if (user != null)
         {
             return(String.Format("{0} failed: {1}: {2}", kind, condition, user));
         }
         else
         {
             return(String.Format("{0} failed: {1}", kind, condition));
         }
     }
     else
     {
         if (user != null)
         {
             return(String.Format("{0} failed: {1}", kind, user));
         }
         else
         {
             return(String.Format("{0} failed.", kind));
         }
     }
 }
Exemplo n.º 2
0
    public static void TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind kind, string message, string user, string condition, Exception inner)
    {
        switch (kind)
        {
        case System.Diagnostics.Contracts.ContractFailureKind.Assert:
            throw new AssertException(user, condition);

        case System.Diagnostics.Contracts.ContractFailureKind.Assume:
            throw new AssumeException(user, condition);

        case System.Diagnostics.Contracts.ContractFailureKind.Invariant:
            throw new InvariantException(user, condition);

        case System.Diagnostics.Contracts.ContractFailureKind.Postcondition:
            throw new PostconditionException(user, condition);

        case System.Diagnostics.Contracts.ContractFailureKind.PostconditionOnException:
            throw new PostconditionOnThrowException(user, condition);

        case System.Diagnostics.Contracts.ContractFailureKind.Precondition:
            throw new PreconditionException(user, condition);
        }
    }
Exemplo n.º 3
0
 public static void TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind kind, string displayMessage, string userMessage, string conditionText, System.Exception innerException)
 {
 }
Exemplo n.º 4
0
 public static string RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind failureKind, string userMessage, string conditionText, System.Exception innerException)
 {
     throw null;
 }
Exemplo n.º 5
0
 public ContractFailedEventArgs(System.Diagnostics.Contracts.ContractFailureKind failureKind, string message, string condition, System.Exception originalException)
 {
 }
 public ContractException(System.Diagnostics.Contracts.ContractFailureKind kind, string?failure, string?userMessage, string?condition, System.Exception?innerException)
 {
 }
 public static string RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind failureKind, string userMessage, string conditionText, System.Exception innerException)
 {
     return(default(string));
 }