示例#1
0
        public void ZyanServerCanRegisterAndResolveComponents()
        {
            using (var server = new ZyanServer())
            {
                server.Register <ISampleSyncService, SampleSyncService>();
                var component = server.Resolve <ISampleSyncService>();

                Assert.NotNull(component);
                Assert.IsType <SampleSyncService>(component);
            }
        }
示例#2
0
        public void ZyanClientCanCallVoidMethodSynchronouslyAndItsActuallyExecutedOnServer()
        {
            using (var server = new ZyanServer(ServerUrl))
            {
                server.Register <ISampleSyncService, SampleSyncService>(Reuse.Singleton);
                var sync = server.Resolve <ISampleSyncService>() as SampleSyncService;
                Assert.False(sync.VoidExecuted);

                using (var client = new ZyanClient(ServerUrl))
                {
                    var proxy = client.CreateProxy <ISampleSyncService>();

                    // Assert.DoesNotThrow
                    proxy.Void();
                    Assert.True(sync.VoidExecuted);
                }
            }
        }
示例#3
0
        public async Task ZyanClientCanCallLongAsyncTaskMethodAndItsActuallyExecuted()
        {
            using (var server = new ZyanServer(ServerUrl))
            {
                server.Register <ISampleAsyncService, SampleAsyncService>(Reuse.Singleton);
                var async = server.Resolve <ISampleAsyncService>() as SampleAsyncService;
                Assert.False(async.LongOperationPerformed);

                using (var client = new ZyanClient(ServerUrl))
                {
                    var proxy = client.CreateProxy <ISampleAsyncService>();

                    // Assert.DoesNotThrow
                    await proxy.PerformLongOperation();

                    Assert.True(async.LongOperationPerformed);
                }
            }
        }