/// <summary> /// Initializes static members of the <see cref="TestWCF"/> class. /// </summary> static TestWCF() { string configPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "WCFConfig\\Service.config"); client = ServiceProxyFactory.Create <IService>(configPath, "endpointName"); //ServiceProxyFactory.GetEndpointAddress<IService>(configPath, "ServiceEndpoint"); }
public void Test() { ServiceRegistry.Register <CalculateService>(); var calculate = ServiceProxyFactory.Create <ICalculate>(); Assert.IsNotNull(calculate); Assert.AreEqual(5, calculate.Add(2, 3)); Assert.AreEqual(9, calculate.Sub(12, 3)); }
public void RegisterProxy <TInterface>() { RegisterResponseListener <TInterface, RemoteResponse>(); RegisterRequestSender <TInterface, RemoteRequest>(); _builder.RegisterType <RemoteProcedureExecutor <TInterface> >() .AsSelf().SingleInstance(); _builder.Register(cc => ServiceProxyFactory.Create(cc.Resolve <RemoteProcedureExecutor <TInterface> >(), cc.Resolve <ResponseConverter>())) .AsImplementedInterfaces().SingleInstance(); }
private TInterface RegisterProxy <TInterface>(Func <dynamic> processAction) { var builder = new ContainerBuilder(); builder.RegisterMockTransport <TInterface>(e => new RemoteResponse(processAction())); builder.RegisterType <ResponseAwaitersRegistry <RemoteResponse> >().AsSelf(); builder.RegisterType <RemoteProcedureExecutor <TInterface> >().AsSelf(); builder.RegisterType <ResponseConverter>().AsSelf(); var container = builder.Build(); var proxy = ServiceProxyFactory.Create( container.Resolve <RemoteProcedureExecutor <TInterface> >(), container.Resolve <ResponseConverter>()); return(proxy); }
static void Main(string[] args) { ICalculator calculator = ServiceProxyFactory <ICalculator> .Create(); var result12 = calculator.Add(1, 2); // var data = calculator.AddUsers(new List<User>() { new User() }); // Console.WriteLine("x + y = {2} when x = {0} and y = {1}", 1, 2, result); IProjectService elementManager = ServiceProxyFactory <IProjectService> .Create(); dynamic user = new DynamicBase(); user.userId = "B7ED32BF48754DC79D99E6157A98E136"; // ResponseData<List<DynamicBase>> result = elementManager.GetProjectsByUserId(user); ResponseData <List <DynamicBase> > result1 = elementManager.GetProjectsByUserId(new T1() { UserId = "B7ED32BF48754DC79D99E6157A98E136" }); }
private void InitializeContainer() { if (this._container == null) { this._container = new Container(_ => { _.For <IWcfService>().Use(ServiceProxyFactory.Create <IWcfService>()).AlwaysUnique(); _.Scan(x => { x.AssembliesFromApplicationBaseDirectory(assembly => assembly.FullName.StartsWith(Common.Constants.AssemblyName, StringComparison.OrdinalIgnoreCase)); x.LookForRegistries(); x.WithDefaultConventions(); }); }); #if DEBUG Debug.WriteLine(this._container.WhatDidIScan()); #endif } }
public void SetUp() { // Create client wrapper this.proxy = ServiceProxyFactory.Create <IMockService>(); }
static Ser1Helper() { string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WCFConfig\\Ser1.config"); _client = ServiceProxyFactory.Create <IContract.IContract>(configPath, "Ser1Endpoint"); }
public IService GetWcfService() { return(ServiceProxyFactory.Create <IService>("ServiceImpl")); }