public void CanCreateDuplexProxyWithCallbackType() { IWindsorContainer localContainer = new WindsorContainer(); localContainer.AddFacility<WcfFacility>(); DuplexClientModel model = new DuplexClientModel { Endpoint = WcfEndpoint.ForContract<IServiceWithCallback>() .BoundTo(new NetTcpBinding()) .At("net.tcp://localhost/ServiceWithCallback") }.WithCallback<ICallbackService>(); localContainer.Register(WcfClient.ForChannels(model)); localContainer.Register(Component.For<ICallbackService>() .ImplementedBy<CallbackService>()); var callbackService = localContainer.Resolve<ICallbackService>(); Assert.AreEqual(0, ((CallbackService)callbackService).ValueFromTheOtherSide); IServiceWithCallback proxy = localContainer.Resolve<IServiceWithCallback>(); proxy.DoSomething(21); Assert.IsAssignableFrom(typeof(CallbackService), callbackService); Assert.AreEqual(42, ((CallbackService)callbackService).ValueFromTheOtherSide); }
public void CanCreateDuplexProxyAndHandleCallback() { CallbackService callbackService = new CallbackService(); IWindsorContainer localContainer = new WindsorContainer(); localContainer.AddFacility<WcfFacility>(); DuplexClientModel model = new DuplexClientModel { Endpoint = WcfEndpoint.ForContract<IServiceWithCallback>() .BoundTo(new NetTcpBinding()) .At("net.tcp://localhost/ServiceWithCallback") }.Callback(callbackService); localContainer.Register(WcfClient.ForChannels(model)); IServiceWithCallback proxy = localContainer.Resolve<IServiceWithCallback>(); proxy.DoSomething(21); Assert.AreEqual(42, callbackService.ValueFromTheOtherSide); }
public void CanCreateDuplexProxyAndHandleCallbackAsynchronously() { CallbackService callbackService = new CallbackService(); IWindsorContainer localContainer = new WindsorContainer(); localContainer.AddFacility <WcfFacility>(); DuplexClientModel model = new DuplexClientModel { Endpoint = WcfEndpoint.ForContract <IServiceWithCallback>() .BoundTo(new NetTcpBinding()) .At("net.tcp://localhost/ServiceWithCallback") }.Callback(callbackService); localContainer.Register(WcfClient.ForChannels(model)); IServiceWithCallback proxy = localContainer.Resolve <IServiceWithCallback>(); proxy.DoSomethingElse(21); Assert.AreEqual(84, callbackService.ValueFromTheOtherSide); }