protected override void beforeEach() { var registry = new FubuRegistry(); ClassUnderTest.As <IFubuRegistryExtension>().Configure(registry); _services = registry.BuildLightGraph().Services; }
public void all_behaviors_chains_should_start_with_the_declared_behavior() { BehaviorGraph graph = registry.BuildLightGraph(); graph.Behaviors.Count().ShouldEqual(3); var visitor = new BehaviorVisitor(new NulloConfigurationObserver(), ""); visitor.Actions += chain => { var wrapper = chain.Top.ShouldBeOfType <Wrapper>(); wrapper.BehaviorType.ShouldEqual(typeof(FakeUnitOfWorkBehavior)); wrapper.Next.ShouldBeOfType <ActionCall>(); }; graph.VisitBehaviors(visitor); }
public void SetUp() { registry = new FubuRegistry(x => { // Tell FubuMVC to enrich the behavior chain for each // RouteHandler with the "FakeUnitOfWorkBehavior" // Kind of like a global [ActionFilter] in MVC x.Policies.EnrichCallsWith <FakeUnitOfWorkBehavior>( call => call.Method.Name == "SomeAction"); // Explicit junk you would only do for exception cases to // override the conventions x.Route("area/sub/{Name}/{Age}") .Calls <TestController>(c => c.SomeAction(null)).OutputToJson(); x.Route("area/sub2/{Name}/{Age}") .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson(); x.Route("area/sub3/{Name}/{Age}") .Calls <TestController>(c => c.ThirdAction(null)).OutputToJson(); }); _graph = registry.BuildLightGraph(); }