1
// ****************************************************************
2
// This is free software licensed under the NUnit license. You may
3
// obtain a copy of the license at http://nunit.org
4
// ****************************************************************
7
using System.Collections.Generic;
9
using System.Diagnostics;
11
namespace NUnit.UiException
14
/// (formerly named TraceExceptionHelper)
16
/// Exposes static methods to assert predicates and throw exceptions
19
public class UiExceptionHelper
22
/// Asserts that reference is not null; otherwise throws an
23
/// ArgumentNullException.
25
/// <param name="value">The reference to be tested.</param>
26
/// <param name="paramName">The name of this reference</param>
28
public static void CheckNotNull(object value, string paramName)
31
throw new ArgumentNullException(paramName);
37
/// Asserts that 'test' is true or throws an ArgumentException.
39
/// <param name="test">The boolean to be tested.</param>
40
/// <param name="message">The error message.</param>
41
/// <param name="paramName">The parameter name to be passed to ArgumentException.</param>
43
public static void CheckTrue(bool test, string message, string paramName)
46
throw new ArgumentException(message, paramName);
52
/// Asserts that 'test' is false or throws an ArgumentException.
54
/// <param name="test">The boolean to be tested.</param>
55
/// <param name="message">The error message.</param>
56
/// <param name="paramName">The parameter name to be passed to ArgumentException.</param>
58
public static void CheckFalse(bool test, string message, string paramName)
61
throw new ArgumentException(message, paramName);
67
/// Throws an ApplicationException with the given message.
69
/// <param name="message">The error message.</param>
71
public static void Fail(string message)
73
throw new ApplicationException(message);
1
// ****************************************************************
2
// This is free software licensed under the NUnit license. You may
3
// obtain a copy of the license at http://nunit.org
4
// ****************************************************************
7
using System.Collections.Generic;
9
using System.Diagnostics;
11
namespace NUnit.UiException
14
/// (formerly named TraceExceptionHelper)
16
/// Exposes static methods to assert predicates and throw exceptions
19
public class UiExceptionHelper
22
/// Asserts that reference is not null; otherwise throws an
23
/// ArgumentNullException.
25
/// <param name="value">The reference to be tested.</param>
26
/// <param name="paramName">The name of this reference</param>
28
public static void CheckNotNull(object value, string paramName)
31
throw new ArgumentNullException(paramName);
37
/// Asserts that 'test' is true or throws an ArgumentException.
39
/// <param name="test">The boolean to be tested.</param>
40
/// <param name="message">The error message.</param>
41
/// <param name="paramName">The parameter name to be passed to ArgumentException.</param>
43
public static void CheckTrue(bool test, string message, string paramName)
46
throw new ArgumentException(message, paramName);
52
/// Asserts that 'test' is false or throws an ArgumentException.
54
/// <param name="test">The boolean to be tested.</param>
55
/// <param name="message">The error message.</param>
56
/// <param name="paramName">The parameter name to be passed to ArgumentException.</param>
58
public static void CheckFalse(bool test, string message, string paramName)
61
throw new ArgumentException(message, paramName);
67
/// Throws an ApplicationException with the given message.
69
/// <param name="message">The error message.</param>
71
public static void Fail(string message)
73
throw new ApplicationException(message);