Skip to content

Commit

Permalink
indenting
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftbot committed Jun 9, 2012
1 parent 12650f7 commit 01a1104
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions Source/AssertEx.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using System;
using AssertExLib;
using AssertExLib.Internal;
using AssertExLib.Exceptions;

namespace AssertExLib
{
public delegate void ThrowsDelegate();
public delegate object ThrowsDelegateWithReturn();
public delegate void ThrowsDelegate();
public delegate object ThrowsDelegateWithReturn();

public static class AssertEx
{
public static void DoesNotThrow(ThrowsDelegate testCode)
{
var ex = Recorder.Exception(testCode);
if (ex != null)
throw new AssertExException("DoesNotThrow failed.", ex);
}
public static class AssertEx
{
public static void DoesNotThrow(ThrowsDelegate testCode)
{
var ex = Recorder.Exception(testCode);
if (ex != null)
throw new AssertExException("DoesNotThrow failed.", ex);
}

public static void DoesNotThrow(ThrowsDelegateWithReturn testCode)
{
Expand All @@ -24,41 +23,41 @@ public static void DoesNotThrow(ThrowsDelegateWithReturn testCode)
throw new AssertExException("DoesNotThrow failed.", ex);
}

public static T Throws<T>(ThrowsDelegate testCode) where T : Exception
{
return (T) Throws(typeof (T), testCode);
}
public static T Throws<T>(ThrowsDelegate testCode) where T : Exception
{
return (T)Throws(typeof(T), testCode);
}

public static T Throws<T>(ThrowsDelegateWithReturn testCode) where T : Exception
{
return (T) Throws(typeof (T), testCode);
}
public static T Throws<T>(ThrowsDelegateWithReturn testCode) where T : Exception
{
return (T)Throws(typeof(T), testCode);
}

public static Exception Throws(Type exceptionType, ThrowsDelegate testCode)
{
var exception = Recorder.Exception(testCode);
public static Exception Throws(Type exceptionType, ThrowsDelegate testCode)
{
var exception = Recorder.Exception(testCode);

if (exception == null)
throw new AssertExException("AssertExtensions.Throws failed. No exception occurred.");
if (exception == null)
throw new AssertExException("AssertExtensions.Throws failed. No exception occurred.");

if (!exceptionType.Equals(exception.GetType()))
throw new AssertExException(String.Format("AssertExtensions.Throws failed. Incorrect exception {0} occurred.", exception.GetType().Name), exception);
if (!exceptionType.Equals(exception.GetType()))
throw new AssertExException(String.Format("AssertExtensions.Throws failed. Incorrect exception {0} occurred.", exception.GetType().Name), exception);

return exception;
}
return exception;
}

public static Exception Throws(Type exceptionType, ThrowsDelegateWithReturn testCode)
{
var exception = Recorder.Exception(testCode);
public static Exception Throws(Type exceptionType, ThrowsDelegateWithReturn testCode)
{
var exception = Recorder.Exception(testCode);

if (exception == null)
throw new AssertExException("AssertExtensions.Throws failed. No exception occurred.");
if (exception == null)
throw new AssertExException("AssertExtensions.Throws failed. No exception occurred.");

if (!exceptionType.Equals(exception.GetType()))
throw new AssertExException(String.Format("AssertExtensions.Throws failed. Incorrect exception {0} occurred.", exception.GetType().Name), exception);
if (!exceptionType.Equals(exception.GetType()))
throw new AssertExException(String.Format("AssertExtensions.Throws failed. Incorrect exception {0} occurred.", exception.GetType().Name), exception);

return exception;
}
}
return exception;
}
}
}

0 comments on commit 01a1104

Please sign in to comment.