[backlinq commit] r275 - trunk/test/BackLINQ.Tests

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 27, 2009, 1:15:57 PM1/27/09
to backlinq...@googlegroups.com
Author: azizatif
Date: Tue Jan 27 09:41:45 2009
New Revision: 275

Modified:
trunk/test/BackLINQ.Tests/Tester.cs

Log:
Extended Tester with a general AssertThat implementation and re-factored
Tester.AssertEquals in terms of AssertThat.


Modified: trunk/test/BackLINQ.Tests/Tester.cs
==============================================================================
--- trunk/test/BackLINQ.Tests/Tester.cs (original)
+++ trunk/test/BackLINQ.Tests/Tester.cs Tue Jan 27 09:41:45 2009
@@ -29,8 +29,10 @@
{
#region Imports

+ using System;
using System.Collections.Generic;
using NUnit.Framework;
+ using NUnit.Framework.Constraints;
using NUnit.Framework.SyntaxHelpers;

#endregion
@@ -39,12 +41,17 @@
{
public static void AssertEquals<T>(this IEnumerable<T> actuals,
params T[] expectations)
{
+ actuals.AssertThat(a => Is.EqualTo(a), expectations);
+ }
+
+ public static void AssertThat<T>(this IEnumerable<T> actuals,
Func<T, Constraint> constrainer, params T[] expectations)
+ {
using (var e = actuals.GetEnumerator())
{
foreach (var expected in expectations)
{
e.MoveNext();
- Assert.That(e.Current, Is.EqualTo(expected));
+ Assert.That(e.Current, constrainer(expected));
}

Assert.That(e.MoveNext(), Is.False);

Reply all
Reply to author
Forward
0 new messages