System.Diagnostics.Assert.Fail C# (CSharp) Method

Fail() public static method

public static Fail ( String conditionString, String message ) : void
conditionString String
message String
return void
    	public static void Fail(String conditionString, String message)
    	{
    		// get the stacktrace
    		StackTrace st = new StackTrace();
    
    		// Run through the list of filters backwards (the last filter in the list
    		// is the default filter. So we're guaranteed that there will be atleast 
    		// one filter to handle the assert.
    
    		int iTemp = iNumOfFilters;
    		while (iTemp > 0)
    		{
    
    			AssertFilters iResult = ListOfFilters [--iTemp].AssertFailure (conditionString, message, st);
    
    			if (iResult == AssertFilters.FailDebug)
    			{
    				if (Debugger.IsAttached == true)
    					Debugger.Break();
    				else
    				{
    					if (Debugger.Launch() == false)
    					{
    						throw new InvalidOperationException(
    								Environment.GetResourceString("InvalidOperation_DebuggerLaunchFailed"));
    					}						
    				}
    
    				break;
    			}
    			else if (iResult == AssertFilters.FailTerminate)
    				Environment.Exit(-1);
    			else if (iResult == AssertFilters.FailIgnore)
    				break;
    
    			// If none of the above, it means that the Filter returned FailContinue.
    			// So invoke the next filter.
    		}
    
    	}