public void Setup() { injector = new RobotlegsInjector(); injector.Map(typeof(RobotlegsInjector)).ToValue(injector); viewProcessorMap = new ViewProcessorMap(new ViewProcessorFactory(injector)); trackingProcessor = new TrackingProcessor(); trackingProcessor2 = new TrackingProcessor(); matchingView = new SupportView(); nonMatchingView = new ObjectB(); guardObject = new GuardObject(); matchingView2 = new SupportViewWithWidthAndHeight(); }
public void a_hook_runs_and_receives_injections_of_view_and_mediator() { mediatorMap.Map(typeof(SupportViewWithWidthAndHeight)).ToMediator(typeof(RectangleMediator)).WithHooks(typeof(HookWithMediatorAndViewInjectionDrawsRectangle)); SupportViewWithWidthAndHeight view = new SupportViewWithWidthAndHeight(); int expectedViewWidth = 100; int expectedViewHeight = 200; injector.Map(typeof(Rectangle)).ToValue(new Rectangle(0, 0, expectedViewWidth, expectedViewHeight)); mediatorMap.HandleView(view, view.GetType()); Assert.That(view.Width, Is.EqualTo(expectedViewWidth)); Assert.That(view.Height, Is.EqualTo(expectedViewHeight)); }