Skip to content

Commit 3e440d8

Browse files
committed
Better support for chaining temp data test methods.
1 parent 1feead8 commit 3e440d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

TestStack.FluentMvcTesting/TempDataResultTest.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public TempDataResultTest(ControllerBase controller)
1212
_controller = controller;
1313
}
1414

15-
public void AndShouldHaveTempDataProperty(string key, object value = null)
15+
public TempDataResultTest AndShouldHaveTempDataProperty(string key, object value = null)
1616
{
1717
var actual = _controller.TempData[key];
1818

@@ -35,9 +35,11 @@ public void AndShouldHaveTempDataProperty(string key, object value = null)
3535
throw new TempDataAssertionException(string.Format(
3636
"Expected value for key \"{0}\" to be \"{1}\", but instead found \"{2}\"", key, value, actual));
3737
}
38+
39+
return this;
3840
}
3941

40-
public void AndShouldHaveTempDataProperty<TValue>(string key, Func<TValue, bool> predicate)
42+
public TempDataResultTest AndShouldHaveTempDataProperty<TValue>(string key, Func<TValue, bool> predicate)
4143
{
4244
var actual = _controller.TempData[key];
4345

@@ -51,6 +53,8 @@ public void AndShouldHaveTempDataProperty<TValue>(string key, Func<TValue, bool>
5153
{
5254
throw new TempDataAssertionException("Expected view model to pass the given condition, but it failed.");
5355
}
56+
57+
return this;
5458
}
5559
}
5660
}

0 commit comments

Comments
 (0)