/// <inheritdoc /> public Tut06() : base(nameof(Tut06)) { Logger.CurrentLogger.Instance.MinimumLoggingLevel = Logger.ELoggingLevel.Trace; serverWebServiceHandler = new WebServiceHandler(); webServiceServer = new WebServiceServer(serverWebServiceHandler); WebServiceHandler.CurrentServiceHandler.Instance.AssignRemoteEndpointToType(typeof(TestWebService), new IPEndPoint((from addr in Dns.GetHostEntry(Dns.GetHostName()).AddressList where addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork select addr).First(), webServiceServer.Port)); }
public void Setup() { _server = new WebServiceServer(); _app = AppInitializer.StartApp(_platform); }
public void TestWebServices() { WebServiceHandler serverWebServiceHandler = new WebServiceHandler(); TestWebService clientImplementation = WebServiceHandler.CurrentServiceHandler.Instance.GetRequesterService <TestWebService>(); TestWebService serverImplementation = serverWebServiceHandler.GetLocalService <TestWebService>(); using (WebServiceServer webServiceServer = new WebServiceServer(serverWebServiceHandler)) { WebServiceHandler.CurrentServiceHandler.Instance.AssignRemoteEndpointToType(typeof(TestWebService), new IPEndPoint((from addr in Dns.GetHostEntry(Dns.GetHostName()).AddressList where addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork select addr).First(), webServiceServer.Port)); clientImplementation.CallSomethingVoid(); Assert.AreEqual(nameof(clientImplementation.CallSomethingReturn), clientImplementation.CallSomethingReturn()); clientImplementation.CallSomethingParamsVoid(nameof(clientImplementation.CallSomethingParamsVoid)); Assert.AreEqual(nameof(TestWebService), clientImplementation.CallSomethingParamsReturn(nameof(clientImplementation.CallSomethingParamsReturn))); clientImplementation.CallSomethingDefaultParamsVoid(nameof(clientImplementation.CallSomethingDefaultParamsVoid)); Assert.AreEqual(nameof(TestWebService), clientImplementation.CallSomethingDefaultParamsReturn(nameof(clientImplementation.CallSomethingDefaultParamsReturn))); try { clientImplementation.ExceptVoid(); Assert.Fail(); } catch (RemoteException e) { Assert.IsTrue(e.InnerException is RemoteException); } try { clientImplementation.ExceptReturn(); Assert.Fail(); } catch (RemoteException e) { Assert.IsTrue(e.InnerException is RemoteException); } } Assert.IsTrue(serverImplementation.Constructor); Assert.IsTrue(clientImplementation.Constructor); // Yes, true. We have to inherit from the constructor. Assert.IsTrue(serverImplementation.VoidMethod); Assert.IsFalse(clientImplementation.VoidMethod); Assert.IsTrue(serverImplementation.VoidMethodWithParameters); Assert.IsFalse(clientImplementation.VoidMethodWithParameters); Assert.IsTrue(serverImplementation.ReturningMethod); Assert.IsFalse(clientImplementation.ReturningMethod); Assert.IsTrue(serverImplementation.ReturningMethodWithParameters); Assert.IsFalse(clientImplementation.ReturningMethodWithParameters); Assert.IsTrue(serverImplementation.ExceptionMethodVoid); Assert.IsFalse(clientImplementation.ExceptionMethodVoid); Assert.IsTrue(serverImplementation.ReturningExceptionMethod); Assert.IsFalse(clientImplementation.ReturningExceptionMethod); Assert.IsTrue(serverImplementation.VoidMethodWithDefaultParameters); Assert.IsFalse(clientImplementation.VoidMethodWithDefaultParameters); Assert.IsTrue(serverImplementation.ReturningMethodWithDefaultParameters); Assert.IsFalse(clientImplementation.ReturningMethodWithDefaultParameters); }