Esempio n. 1
0
        public static void StartServer(TestContext ctx)
        {
            ZyanSettings.LegacyBlockingEvents        = true;
            ZyanSettings.LegacyBlockingSubscriptions = true;

            var serverSetup = new NullServerProtocolSetup(4567);

            ZyanHost = new ZyanComponentHost("EventFilterServer", serverSetup);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer>();

            ZyanConnection = new ZyanConnection("null://NullChannel:4567/EventFilterServer");
        }
Esempio n. 2
0
        public static void StartServer(TestContext ctx)
        {
            ZyanSettings.LegacyBlockingEvents        = true;
            ZyanSettings.LegacyBlockingSubscriptions = true;

            var serverSetup = new NullServerProtocolSetup(3456);

            ZyanHost = new ZyanComponentHost("CallInterceptorServer", serverSetup);
            ZyanHost.RegisterComponent <IInterceptableComponent, InterceptableComponent>(ActivationType.Singleton);

            ZyanConnection = new ZyanConnection("null://NullChannel:3456/CallInterceptorServer");
            ZyanConnection.CallInterceptionEnabled = true;
        }
        public static void StartServer(TestContext ctx)
        {
            var serverSetup = new NullServerProtocolSetup(1234);

            ZyanHost = new ZyanComponentHost("DuckTypingServer", serverSetup);

            // registration-time check
            ZyanHost.RegisterComponent <IDuck, Platypus>("Platypus");

            // invocation-time check (object factory can't be verified during registration)
            ZyanHost.RegisterComponent <IDuck>("Chicken", () => new Chicken());

            ZyanConnection = new ZyanConnection("null://NullChannel:1234/DuckTypingServer");
        }
Esempio n. 4
0
        public static void StartServer(TestContext ctx)
        {
            var serverSetup = new NullServerProtocolSetup(5432);

            ZyanHost = new ZyanComponentHost("SampleQueryableServer", serverSetup);

            ZyanHost.RegisterComponent <ISampleService, SampleService>();
            ZyanHost.RegisterComponent <IObjectSource, SampleObjectSource>(new SampleObjectSource(new[] { "Hello", "World!" }));
            ZyanHost.RegisterComponent <IObjectSource, SampleObjectSource>("Sample1", new SampleObjectSource(new[] { "this", "is", "an", "example" }));
            ZyanHost.RegisterComponent <IObjectSource, SampleObjectSource>("Sample6");
            ZyanHost.RegisterComponent <IObjectSource, SampleObjectSource>("Sample7", ActivationType.SingleCall);
            ZyanHost.RegisterComponent <IEntitySource, DataWrapper>("DbSample", new DataWrapper());

            ZyanConnection = new ZyanConnection("null://NullChannel:5432/SampleQueryableServer");
        }
Esempio n. 5
0
        private static ZyanComponentHost CreateZyanHost(int port, string name)
        {
            ZyanSettings.LegacyBlockingEvents           = true;
            ZyanSettings.LegacyBlockingSubscriptions    = true;
            ZyanSettings.LegacyUnprotectedEventHandlers = true;

            var serverSetup = new NullServerProtocolSetup(port);
            var zyanHost    = new ZyanComponentHost(name, serverSetup);          //, DummySessionManager);

            zyanHost.RegisterComponent <ISampleServer, SampleServer <int> >("Singleton", ActivationType.Singleton);
            zyanHost.RegisterComponent <ISampleServer, SampleServer <short> >("Singleton2", ActivationType.Singleton);
            zyanHost.RegisterComponent <ISampleServer, SampleServer <long> >("Singleton3", ActivationType.Singleton);
            zyanHost.RegisterComponent <ISampleServer, SampleServer <byte> >("SingleCall", ActivationType.SingleCall);
            zyanHost.RegisterComponent <ISampleServer, SampleServer <char> >("SingletonExternal", new SampleServer <char>());
            return(zyanHost);
        }
Esempio n. 6
0
        public static void StartServer(TestContext ctx)
        {
            ZyanSettings.LegacyBlockingEvents           = true;
            ZyanSettings.LegacyBlockingSubscriptions    = true;
            ZyanSettings.LegacyUnprotectedEventHandlers = true;

            var serverSetup = new NullServerProtocolSetup(2345);

            ZyanHost = new ZyanComponentHost("EventsServer", serverSetup);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer <int> >("Singleton", ActivationType.Singleton);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer <short> >("Singleton2", ActivationType.Singleton);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer <long> >("Singleton3", ActivationType.Singleton);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer <byte> >("SingleCall", ActivationType.SingleCall);
            ZyanHost.RegisterComponent <ISampleServer, SampleServer <char> >("SingletonExternal", new SampleServer <char>());

            ZyanConnection = new ZyanConnection("null://NullChannel:2345/EventsServer");
        }
Esempio n. 7
0
        public void SessionVariablesAreStoredWithinTheCurrentSession()
        {
            var server = new NullServerProtocolSetup(123);
            var client = new NullClientProtocolSetup();

            using (var host = new ZyanComponentHost("SessionSample", server))
            {
                host.RegisterComponent <ISessionSample, SessionSample>();

                using (var conn = new ZyanConnection(client.FormatUrl(123, "SessionSample"), client))
                {
                    var proxy = conn.CreateProxy <ISessionSample>();
                    proxy.Set("Hello", "World");
                    Assert.AreEqual("World", proxy.Get("Hello"));

                    var temp = proxy.Get("Undefined");
                    Assert.IsNull(temp);
                    proxy.Set("Undefined", "Defined");
                    Assert.AreEqual("Defined", proxy.Get("Undefined"));
                }
            }
        }