This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomConvention : Convention | |
{ | |
public CustomConvention() | |
{ | |
Classes | |
.NameEndsWith("Tests"); | |
Cases | |
.Where(method => method.IsVoid()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Matt Howells's Shuffler from http://stackoverflow.com/a/110570 | |
public static void Shuffle<T>(this T[] array, Random random) | |
{ | |
int n = array.Length; | |
while (n > 1) | |
{ | |
int k = random.Next(n--); | |
T temp = array[n]; | |
array[n] = array[k]; | |
array[k] = temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Jon Skeet's Bubble Sort from http://stackoverflow.com/a/1595310 | |
public void BubbleSort<T>(IList<T> list, IComparer<T> comparer) | |
{ | |
bool stillGoing = true; | |
while (stillGoing) | |
{ | |
stillGoing = false; | |
for (int i = 0; i < list.Length-1; i++) | |
{ | |
T x = list[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Random rnd=new Random(); | |
string[] shuffled = array.OrderBy(x => rnd.Next()).ToArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleTestClass : IDisposable | |
{ | |
bool disposed; | |
public SampleTestClass() | |
{ | |
WhereAmI(); | |
} | |
public void Pass() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
method.Invoke(instance, null); | |
} | |
catch (TargetInvocationException ex) | |
{ | |
throw new PreservedException(ex.InnerException); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExceptionList DoSomething() | |
{ | |
// Do the actual work here... | |
// Return an empty list of exceptions | |
// to indicate success. | |
return new ExceptionList(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object instance; | |
var constructionExceptions = Construct(testClass, out instance); | |
if (constructionExceptions.Any()) | |
{ | |
foreach (var @case in cases) | |
@case.Exceptions.Add(constructionExceptions); | |
} | |
else | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExceptionList exceptions = new ExceptionList(); | |
try | |
{ | |
method.Invoke(instance, null); | |
} | |
catch (TargetInvocationException ex) | |
{ | |
exceptions.Add(ex.InnerException); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
method.Invoke(instance, null); | |
} | |
catch (TargetInvocationException ex) | |
{ | |
throw ex.InnerException; | |
} |