public void A_Hook_Runs_And_Receives_Injection_Of_View() { viewProcessorMap.Map(matchingView2.GetType()).ToProcess(trackingProcessor).WithHooks(typeof(HookWithViewInjectionChangesSize)); int expectedViewWidth = 100; int expectedViewHeight = 200; injector.Map(typeof(int), "rectHeight").ToValue(expectedViewHeight); injector.Map(typeof(int), "rectWidth").ToValue(expectedViewWidth); viewProcessorMap.Process(matchingView2); Assert.That(matchingView2.Width, Is.EqualTo(expectedViewWidth)); Assert.That(matchingView2.Height, Is.EqualTo(expectedViewHeight)); }
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)); }