public async void TestSendAndReceive()
        {
            var resolver = new DependencyResolver();

            using (var server = new RedisServer(new RedisConnection(RedisHost, RedisPort, RedisPassword), ServerQueue, new ServiceFactory(resolver)))
            {
                server.Listen();

                using (var client = new RedisClient(new RedisConnection(RedisHost, RedisPort, RedisPassword), ClientQueue, ServerQueue))
                {
                    var clientFactory = new ServiceProxy.ServiceClientFactory(client);

                    var serviceClient = clientFactory.CreateServiceClient<ITestService2>();

                    Assert.That(serviceClient.GetPerson(1), Is.Not.Null);

                    var persons = await serviceClient.ListPersonsAsync(5);
                    Assert.That(persons, Is.Not.Null);
                    Assert.AreEqual(5, persons.Count());

                    var nullCollection = await serviceClient.ListPersonsAsync(-1);
                    Assert.IsNull(nullCollection);

                    var nullObject = serviceClient.GetPerson(-1);
                    Assert.IsNull(nullObject);
                }
            }
        }
        public async void TestSendAndReceive()
        {
            var resolver = new DependencyResolver();

            using (var server = new RedisServer(new RedisConnection(RedisHost, RedisPort, RedisPassword), ServerQueue, new ServiceFactory(resolver)))
            {
                server.Listen();

                using (var client = new RedisClient(new RedisConnection(RedisHost, RedisPort, RedisPassword), ClientQueue, ServerQueue))
                {
                    var clientFactory = new ServiceProxy.ServiceClientFactory(client);

                    var serviceClient = clientFactory.CreateServiceClient <ITestService2>();

                    Assert.That(serviceClient.GetPerson(1), Is.Not.Null);

                    var persons = await serviceClient.ListPersonsAsync(5);

                    Assert.That(persons, Is.Not.Null);
                    Assert.AreEqual(5, persons.Count());

                    var nullCollection = await serviceClient.ListPersonsAsync(-1);

                    Assert.IsNull(nullCollection);

                    var nullObject = serviceClient.GetPerson(-1);
                    Assert.IsNull(nullObject);
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            using (var client = new RedisClient(new RedisConnection("localhost"), "ThisIsTheClientQueue", "ThisIsTheServiceQueue"))
            {
                var clientFactory = new ServiceProxy.ServiceClientFactory(client);

                var fooService = clientFactory.CreateServiceClient <IFooService>();

                Console.WriteLine("Press ENTER for GetFooAndUpdate test");
                Console.ReadLine();

                GetFooAndUpdate(fooService);

                Console.WriteLine("Press ENTER for SimpleBenchmark test");
                Console.ReadLine();

                SimpleBenchmark(fooService).Wait();

                Console.WriteLine("Press ENTER to exit");
                Console.ReadLine();
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            using (var client = new RedisClient(new RedisConnection("localhost"), "ThisIsTheClientQueue", "ThisIsTheServiceQueue"))
            {
                var clientFactory = new ServiceProxy.ServiceClientFactory(client);

                var fooService = clientFactory.CreateServiceClient<IFooService>();

                Console.WriteLine("Press ENTER for GetFooAndUpdate test");
                Console.ReadLine();

                GetFooAndUpdate(fooService);

                Console.WriteLine("Press ENTER for SimpleBenchmark test");
                Console.ReadLine();

                SimpleBenchmark(fooService).Wait();

                Console.WriteLine("Press ENTER to exit");
                Console.ReadLine();
            }
        }