Permalink
Browse files

- Added support for aliased actions when using conventional expectati…

…ons.

- Fixed issue with ExpectationGroupBuilder not considering aliased actions.
- Improved specifications for SecurityConfigurationExtensions.
  • Loading branch information...
1 parent f1e9e6f commit 2a7c07657c9f6a853f868a14f84f3056bd163a2f Kristoffer Ahl committed Oct 13, 2012
@@ -63,20 +63,20 @@ public void Should_verify_expectations_for_aliased_action()
{
SecurityConfigurator.Configure(configuration => configuration.For<SampleController>(a => a.ActualAction()).DenyAnonymousAccess());
var policyExpectations = new PolicyExpectations();
- policyExpectations.For<SampleController>(a => a.ActualAction()).Has<DenyAnonymousAccessPolicy>();
+ policyExpectations.For<SampleController>(a => a.ActualAction()).Has<DenyAnonymousAccessPolicy>();
var results = policyExpectations.VerifyAll(SecurityConfiguration.Current);
Assert.That(results.Valid(), results.ErrorMessages());
}
[Test]
- public void Should_verify_expectations_for_aliased_action_using_convention_configuration()
+ public void Should_verify_expectations_for_aliased_action_using_convention_expectations()
{
- SecurityConfigurator.Configure(configuration => configuration.ForAllControllers().DenyAnonymousAccess());
+ SecurityConfigurator.Configure(configuration => configuration.For<SampleController>().DenyAnonymousAccess());
var policyExpectations = new PolicyExpectations();
- policyExpectations.For<SampleController>(a => a.ActualAction()).Has<DenyAnonymousAccessPolicy>();
-
+
+ policyExpectations.For<SampleController>().Has<DenyAnonymousAccessPolicy>();
var results = policyExpectations.VerifyAll(SecurityConfiguration.Current);
Assert.That(results.Valid(), results.ErrorMessages());
@@ -36,7 +36,7 @@ private static IEnumerable<ExpectationGroup> CreateExpectationGroupsFor(Expectat
if (String.IsNullOrEmpty(expectationExpression.Action))
{
var actionMethods = expectationExpression.Controller.GetActionMethods();
- foreach (var expectationGroup in actionMethods.Select(actionMethod => new ExpectationGroup(expectationExpression.Controller, actionMethod.Name)))
+ foreach (var expectationGroup in actionMethods.Select(actionMethod => new ExpectationGroup(expectationExpression.Controller, actionMethod.GetActionName())))
{
expectationExpression.Expectations.Each(expectationGroup.ApplyExpectation);
groups.Add(expectationGroup);

0 comments on commit 2a7c076

Please sign in to comment.