Exemplo n.º 1
0
        static void RestDefault()
        {
            var path = new Uri("http://localhost:8088/");
            var foo = new Foo();
            var service = new RestService();
            service.Initialize(path, foo);
            service.StartAsync().Wait();

            RestClient<IFoo> client;
            var clientCreateResult = RestClient<IFoo>.TryCreate(path, out client);

            client.Instance.SetName("bar");

            service.StopAsync().Wait();
            service.Host.Close();
        }
Exemplo n.º 2
0
        public void RestDefault()
        {
            var path = new Uri("http://localhost:8088/");
            var foo = new Foo();
            var service = new RestService();
            service.Initialize(path, foo);
            service.StartAsync().Wait();
            Assert.IsTrue(service.IsListening);

            RestClient<IFoo> client;
            var clientCreateResult = RestClient<IFoo>.TryCreate(path, out client);
            Assert.IsTrue(clientCreateResult);

            client.Instance.SetName("bar");
            Assert.AreEqual<string>("bar", foo.Name);

            service.StopAsync().Wait();
        }