public void CanRegisterEventArgsRoute() { OutComponent outComponent = new OutComponent(); InComponent inComponent = new InComponent(); TestEventArgs e = new TestEventArgs("RouteOut", 100); EventToMethodRoute route = EventToMethodRoute.Create <TestEventArgs>(outComponent, "TestEventOut", inComponent, (x) => inComponent.TestEventArgsActionIn(x)); route.RegisterRoute(); if (!route.IsRegistered) { Assert.Fail("Route not registered."); } outComponent.RaiseTestEventOut(e); route.UnregisterRoute(); Assert.AreEqual(inComponent.IntInProperty, e.EventInteger); }
public void CanRegisterEventArgsRouteWithReferenceConverter() { OutComponent outComponent = new OutComponent(); InComponent inComponent = new InComponent(); TestEventArgs e = new TestEventArgs("RouteOut", 100); TestEventArgsToStringRouteConverter converter = new TestEventArgsToStringRouteConverter(); EventToMethodRoute route = EventToMethodRoute.Create <string>(outComponent, "TestEventOut", inComponent, (x) => inComponent.StringActionIn(x), converter); route.RegisterRoute(); if (!route.IsRegistered) { Assert.Fail("Route not registered."); } outComponent.RaiseTestEventOut(e); route.UnregisterRoute(); Assert.IsTrue(string.Compare(e.EventString, inComponent.StringInProperty, false) == 0); }
public void CanRegisterEventArgsRouteWithValueConverter() { OutComponent outComponent = new OutComponent(); InComponent inComponent = new InComponent(); TestEventArgs e = new TestEventArgs("RouteOut", 100); TestEventArgsToIntRouteConverter converter = new TestEventArgsToIntRouteConverter(); EventToPropertyRoute route = EventToPropertyRoute.Create(outComponent, "TestEventOut", inComponent, x => inComponent.IntInProperty, converter); route.RegisterRoute(); if (!route.IsRegistered) { Assert.Fail("Route not registered."); } outComponent.RaiseTestEventOut(e); route.UnregisterRoute(); Assert.AreEqual(inComponent.IntInProperty, e.EventInteger); }