예제 #1
0
        public async Task PostDouble()
        {
            //// Arrange

            // The nl-NL culture is one of the cultures that uses a comma as the decimal separator.
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("nl-NL");
            var geoClient = new GeoClient(new HttpClient())
            {
                BaseUrl = "http://localhost:13452"
            };
            const double value = 0.5d;

            //// Act
            try
            {
                // This tests whether the value is encoded in the client using the invariant culture. If not, API method will receive the value as null (since it is optional).
                var result = await geoClient.PostDoubleAsync(value);

                //// Assert
                Assert.AreEqual(value, result.Result);
            }
            catch (GeoClientException exception)
            {
                Assert.IsTrue(exception.InnerException is ArgumentException);
                Assert.IsTrue(exception.InnerException.StackTrace.Contains("NSwag.Integration.WebAPI.Controllers.GeoController.SaveItems"));
            }
        }
예제 #2
0
        private void btnUpdateBatch_Click(object sender, RoutedEventArgs e)
        {
            List <ZipCityData> cityZipList = new List <ZipCityData>()
            {
                new ZipCityData()
                {
                    ZipCode = "07035", City = "Bedrock"
                },
                new ZipCityData()
                {
                    ZipCode = "33033", City = "End of the World"
                }
            };

            try
            {
                GeoClient proxy = new GeoClient();

                proxy.UpdateZipCity(cityZipList);

                proxy.Close();

                MessageBox.Show("Updated.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
            }
        }
        private void BtnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtState.Text))
                {
                    var address = new EndpointAddress("net.tcp://localhost/GeoLib.WebHost/GeoService.svc");
                    var binding = new NetTcpBinding();

                    GeoClient proxy = new GeoClient(binding, address);
                    IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);

                    if (data != null)
                    {
                        lstZips.ItemsSource = data;
                    }

                    proxy.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #4
0
        private void btnPutBack_Click(object sender, RoutedEventArgs e)
        {
            List <ZipCityData> cityZipList = new List <ZipCityData>()
            {
                new ZipCityData()
                {
                    ZipCode = "07035", City = "Lincoln Park"
                },
                new ZipCityData()
                {
                    ZipCode = "33033", City = "Homestead"
                }
            };

            try
            {
                GeoClient proxy = new GeoClient();

                proxy.UpdateZipCity(cityZipList);

                proxy.Close();

                MessageBox.Show("Updated.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
            }
        }
예제 #5
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient();

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }

                    proxy.Close();
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Fault Exception: " + ex.Message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            _Proxy = new GeoClient(new InstanceContext(this), "tcpEp");
            _Proxy2 = new StatefulGeoClient();
            _SyncContext = SynchronizationContext.Current;

        }
예제 #7
0
 //GeoClient _Proxy = null;
 public MainWindow()
 {
     InitializeComponent();
     this.Title = "UI Running on Thread" + Thread.CurrentThread.ManagedThreadId +
         " | Process" + Process.GetCurrentProcess().Id.ToString();
     _Proxy = new GeoClient("tcpEP");
     _StateFulProxy = new StateFulGeoClient();
 }
예제 #8
0
        public MainWindow()
        {
            InitializeComponent();

            _Proxy = new GeoClient("");
            _Proxy.Open();
            _SyncContext = SynchronizationContext.Current;
        }
예제 #9
0
 public MainWindow()
 {
     InitializeComponent();
     this.Title = "UI Running on Thread " + Thread.CurrentThread.ManagedThreadId
         + " | Process " + Process.GetCurrentProcess().Id.ToString();
     LoadComboBox();
     endpointName = cbEndpoint.SelectedValue.ToString();
     _proxy = new GeoClient(endpointName);
 }
예제 #10
0
        public MainWindow()
        {
            InitializeComponent();

            this.Title = "UI Running on Thread " + Thread.CurrentThread.ManagedThreadId +
                         " | Process " + Process.GetCurrentProcess().Id.ToString();
            _proxy = new GeoClient();
            _proxy.Open();
            _proxy2 = new StatefulGeoClient();
        }
예제 #11
0
        private void GetInfoBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var proxy = new GeoClient();

            ZipCodeData data = proxy.GetZipInfo("");

            GetInfoTextBlock.Text = $"{data.City} \r\n {data.State} \r\n {data.ZipCode}";

            proxy.Close();
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                    if (data != null)
                    {
                        lblCity.Content = data.City;
                        lblState.Content = data.State;
                    }
                    else
                    {
                        lblCity.Content = "N/A";
                        lblState.Content = "N/A";
                    }
                    proxy.Close();
                }
                catch (FaultException<ExceptionDetail> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ExceptionDetail>" + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException<ApplicationException> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ApplicationException>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException<NotFoundData> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<NotFoundData>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Faultxception thrown by service.\n\rException type: " +
                                  "FaultException" + "\n\r" +
                                  "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " + ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
            }
        }
예제 #13
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

                try
                {
                    ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                    if (data != null)
                    {
                        lblCity.Content  = data.City;
                        lblState.Content = data.State;
                    }
                    else
                    {
                        lblCity.Content  = "N/A";
                        lblState.Content = "N/A";
                    }
                    proxy.Close();
                }
                catch (FaultException <ExceptionDetail> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ExceptionDetail>" + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException <ApplicationException> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<ApplicationException>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException <NotFoundData> ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " +
                                    "FaultException<NotFoundData>" + "\n\r" +
                                    "Reason: " + ex.Message + "\n\r" +
                                    "Message: " + ex.Detail.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (FaultException ex)
                {
                    MessageBox.Show("Faultxception thrown by service.\n\rException type: " +
                                    "FaultException" + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception thrown by service.\n\rException type: " + ex.GetType().Name + "\n\r" +
                                    "Message: " + ex.Message + "\n\r" + "Proxy state: " + proxy.State);
                }
            }
        }
예제 #14
0
        public async Task UploadFile()
        {
            //// Arrange
            var geoClient = new GeoClient("http://localhost:13452");

            //// Act
            var result = await geoClient.UploadFileAsync(new FileParameter(new MemoryStream(new byte[] { 1, 2 })));

            //// Assert
            Assert.IsTrue(result);
        }
예제 #15
0
        public async Task UploadFile()
        {
            //// Arrange
            var geoClient = new GeoClient { BaseUrl = "http://localhost:13452" };

            //// Act
            var result = await geoClient.UploadFileAsync(new FileParameter(new MemoryStream(new byte[] { 1, 2 })));

            //// Assert
            Assert.IsTrue(result);
        }
예제 #16
0
        private void btnOneWay_Click(object sender, RoutedEventArgs e)
        {
            GeoClient proxy = new GeoClient(new InstanceContext(this));

            proxy.OneWayExample();
            MessageBox.Show("Oneway Example called. Back at client.");

            proxy.Close();

            MessageBox.Show("Proxy is closed");
        }
예제 #17
0
        private void btnOneWay_Click(object sender, RoutedEventArgs e)
        {
            GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            proxy.OneWayExample();

            MessageBox.Show("Oneway example. Back at client");

            proxy.Close();

            MessageBox.Show("Proxy close");
        }
예제 #18
0
        private void btnOneWay_Click(object sender, RoutedEventArgs e)
        {
            GeoClient proxy = new GeoClient("tcpEP");

            proxy.OneWayExample();

            MessageBox.Show("Oneway example called. Back at client.");

            proxy.Close();

            MessageBox.Show("Proxy is now close.");
        }
예제 #19
0
        private async void btnPutBack_Click(object sender, RoutedEventArgs e)
        {
            List <ZipCityData> cityZipList = new List <ZipCityData>()
            {
                new ZipCityData()
                {
                    ZipCode = "07035", City = "Lincoln Park"
                },
                new ZipCityData()
                {
                    ZipCode = "33033", City = "Homestead"
                },
                new ZipCityData()
                {
                    ZipCode = "90210", City = "Beverly Hills"
                },
                new ZipCityData()
                {
                    ZipCode = "07094", City = "Secaucus"
                }
            };

            lstZips2.Items.Clear();
            //await Task.Run(() =>
            //{

            //    try
            //    {
            //        GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            //        proxy.UpdateZipCity(cityZipList);

            //        proxy.Close();

            //        MessageBox.Show("Updated.");
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: " + ex.Message);
            //    }
            //});
            GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            Task <int> task = proxy.UpdateZipCityAsync(cityZipList);

            task.ContinueWith(result =>
            {
                MessageBox.Show(string.Format("Updated {0} items.", result.Result));
            });
            // MessageBox.Show("Call made");
        }
예제 #20
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("tcpEP");                       //Pass tcpEP or httpEP

                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content  = data.City;
                    lblState.Content = data.State;
                }
            }
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text == "") return;

            using (GeoClient proxy = new GeoClient("httpEP"))
            {
                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);

                if (data == null) return;

                lblCity.Content = data.City;
                lblState.Content = data.State;
            }
        }
예제 #22
0
        public MainWindow()
        {
            InitializeComponent();

            _Proxy = new GeoClient("tcpEP");
            _Proxy.Open();
            _ProxyStateful = new StatefulGeoClient();

            _SyncContext   = SynchronizationContext.Current;
            _TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            this.Title = "UI Running on Thread " + Thread.CurrentThread.ManagedThreadId +
                         " | Process " + Process.GetCurrentProcess().Id.ToString();
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != null)
            {
                GeoClient proxy = new GeoClient();

                IEnumerable <ZipCode> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                proxy.Close();
            }
        }
예제 #24
0
        private void btnGetInfo_Click( object sender, RoutedEventArgs e )
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("webEP");
                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content = data.City;
                    lblState.Content = data.State;
                }
                proxy.Close();

            }
        }
        private void BtnGetInfo_OnClick(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != null)
            {
                var proxy = new GeoClient("httpEP");
                var data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content = data.City;
                    lblState.Content = data.State;
                }

                proxy.Close();
            }
        }
예제 #26
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(zipCode.Text))
            {
                client = new GeoClient("tcpEP");
                var result = client.GetZipcodeInfo(zipCode.Text);
                if (result != null)
                {
                    lblCity.Content  = result.City;
                    lblState.Content = result.State;
                }

                //client.Close();
            }
        }
예제 #27
0
        public MainWindow()
        {
            InitializeComponent();

            //This string sent to GeoClient constructor will define which configuration will be used. Very flexible. Check App.Config.
            //This call, in the way it's configured, will only work with WindowsHost. For WebHost, use webEP.
            _Proxy = new GeoClient("tcpEP");

            //Sleeping to have the chance to click Start Service on WindowsHost.
            Thread.Sleep(3000);
            _Proxy.Open();

            _ProxyStateful = new StatefulGeoClient();
            _SyncContext   = SynchronizationContext.Current;
        }
예제 #28
0
        private async void btnUpdateBatch_Click(object sender, RoutedEventArgs e)
        {
            var cityZipList = new List <ZipCityData>
            {
                new ZipCityData {
                    ZipCode = "07035", City = "Bedrock"
                },
                new ZipCityData {
                    ZipCode = "33033", City = "End of the World"
                },
                new ZipCityData {
                    ZipCode = "90210", City = "Alderan"
                },
                new ZipCityData {
                    ZipCode = "07094", City = "Storybrooke"
                }
            };

            lstUpdates.Items.Clear();

            //await Task.Run(() =>
            //{
            //    try
            //    {
            //        var proxy = new GeoClient(new InstanceContext(this), "tcpEP");

            //        proxy.UpdateZipCity(cityZipList);

            //        proxy.Close();

            //        MessageBox.Show("Updated.");
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: " + ex.Message);
            //    }
            //});

            GeoClient  proxy = new GeoClient(new InstanceContext(this), "tcpEP");
            Task <int> task  = proxy.UpdateZipCityAsync(cityZipList);

            task.ContinueWith(x =>
            {
                MessageBox.Show(string.Format("Service returned {0} items.", x.Result));
            });

            MessageBox.Show("Call made.");
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != "")
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding         binding = new NetTcpBinding();
                GeoClient       proxy   = new GeoClient(binding, address);

                IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZipCodes.ItemsSource = data;
                }
                proxy.Close();
            }
        }
        public void GetZipCodes()
        {
            var tempProxy = new GeoClient("tcpEP");
            if (string.IsNullOrEmpty(State)) return;

            var data = tempProxy.GetZips(State);

            this.ZipCodes.Clear();

            foreach (var zipCodeData in data)
            {
                this.ZipCodes.Add(zipCodeData);
            }
            
            tempProxy.Close();
        }
예제 #31
0
        public async Task QueryStringParameters()
        {
            //// Arrange
            var geoClient = new GeoClient(new HttpClient())
            {
                BaseUrl = "http://localhost:13452"
            };

            //// Act
            var result = await geoClient.ReverseAsync(new string[] { "foo", "bar" });

            //// Assert
            Assert.AreEqual(2, result.Result.Count);
            Assert.AreEqual("foo", result.Result[1]);
            Assert.AreEqual("bar", result.Result[0]);
        }
예제 #32
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtState.Text))
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                System.ServiceModel.Channels.Binding bind = new NetTcpBinding();
                GeoClient client = new GeoClient(bind, address);
                var       result = client.GetZips(txtState.Text);
                if (result != null)
                {
                    lstZips.ItemsSource = result;
                }

                client.Close();
            }
        }
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text != "")
            {
                GeoClient proxy = new GeoClient("GeoLibRouter");

                ZipCodeData data = proxy.GetZipInfo(txtZipCode.Text);
                if (data != null)
                {
                    lblCity.Content  = data.City;
                    lblState.Content = data.State;
                }

                proxy.Close();
            }
        }
예제 #34
0
        private void btnGetInfo_Click(object sender, RoutedEventArgs e)
        {
            if (txtZipCode.Text == "")
            {
                return;
            }
            var proxy = new GeoClient("webEP");
            var data  = proxy.GetZipInfo(txtZipCode.Text);

            if (data != null)
            {
                lblCity.Content  = data.City;
                lblState.Content = data.State;
            }
            proxy.Close();
        }
예제 #35
0
        public async Task FileDownload()
        {
            //// Arrange
            var geoClient = new GeoClient(new HttpClient())
            {
                BaseUrl = "http://localhost:13452"
            };

            //// Act
            using (var response = await geoClient.GetUploadedFileAsync(1, true))
            {
                //// Assert
                Assert.AreEqual(1, response.Stream.ReadByte());
                Assert.AreEqual(2, response.Stream.ReadByte());
                Assert.AreEqual(3, response.Stream.ReadByte());
            }
        }
        private void BtnGetZipCodes_OnClick(object sender, RoutedEventArgs e)
        {
            if (txtState != null)
            {
                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                Binding binding = new NetTcpBinding();

                GeoClient proxy = new GeoClient(binding, address);

                var datas = proxy.GetZips(txtState.Text);

                if (datas != null)
                {
                    lstZips.ItemsSource = datas;
                }
            }
        }
예제 #37
0
        private void buttonInfo_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxInfo.Text != "")
            {
                GeoClient geoClientProxy = new GeoClient();

                ZipCodeData zipCodeData = geoClientProxy.GetZipInfo(textBoxInfo.Text);

                if (zipCodeData != null)
                {
                    lblCity.Content  = zipCodeData.City;
                    lblState.Content = zipCodeData.State;
                }

                geoClientProxy.Close();
            }
        }
예제 #38
0
        private void btnPutBack_Click(object sender, RoutedEventArgs e)
        {
            List <ZipCityData> cityZipList = new List <ZipCityData>()
            {
                new ZipCityData()
                {
                    ZipCode = "07035", City = "Lincoln Park"
                },
                new ZipCityData()
                {
                    ZipCode = "33033", City = "Homestead"
                },
                new ZipCityData()
                {
                    ZipCode = "90210", City = "Beverly Hills"
                },
                new ZipCityData()
                {
                    ZipCode = "07094", City = "Secaucus"
                }
            };

            lstUpdates.Items.Clear();

            Thread thread = new Thread(() =>
            {
                try
                {
                    GeoClient proxy = new GeoClient(new InstanceContext(this));
                    proxy.Open();

                    proxy.UpdateZipCity(cityZipList);

                    proxy.Close();

                    MessageBox.Show("Updated.");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message);
                }
            });

            thread.Start();
        }
예제 #39
0
        private void GetZipCodesBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
            var binding = new NetTcpBinding();
            var proxy   = new GeoClient(binding, address);

            ZipCodeData[] data = proxy.GetZips("");

            var sb = new StringBuilder();

            foreach (var zipCodeData in data)
            {
                sb.AppendLine($"State: {zipCodeData.State} City: {zipCodeData.City} ZipCode: {zipCodeData.ZipCode}");
            }

            GetZipsTextBLock.Text = sb.ToString();
            proxy.Close();
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text != null)
            {
                //GeoClient proxy = new GeoClient();
                //IGeoService proxy = CreateProxy();
                GeoClient proxy = new GeoClient("dynamicGeoService");

                IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                ((IDisposable)proxy).Dispose();
                //proxy.Close();
            }
        }
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if (txtState.Text == "") return;

            EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
            NetTcpBinding binding = new NetTcpBinding();
            binding.MaxReceivedMessageSize = 2097152;

            using (GeoClient client = new GeoClient(binding, address))
            {
                IEnumerable<ZipCodeData> data = client.GetZips(txtState.Text);

                if (data == null) return;

                lstZips.ItemsSource = data;

            }
        }
        private void BtnGetInfo_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.TxtZipCode.Text))
            {
                return;
            }

            var proxy = new GeoClient("httpEP");

            var data = proxy.GetZipInfo(this.TxtZipCode.Text);
            if (data != null)
            {
                LblCity.Content = data.City;
                LblState.Content = data.State;
            }

            proxy.Close();
        }
예제 #43
0
        public async Task SaveItems()
        {
            //// Arrange
            var geoClient = new GeoClient { BaseUrl = "http://localhost:13452" };

            //// Act
            try
            {
                await geoClient.SaveItemsAsync(null);

                //// Assert
                Assert.Fail();
            }
            catch (GeoClientException exception)
            {
                Assert.IsTrue(exception.InnerException is ArgumentException);
                Assert.IsTrue(exception.InnerException.StackTrace.Contains("NSwag.Integration.WebAPI.Controllers.GeoController.SaveItems"));
            }
        }
예제 #44
0
        private void bthGetZipCodes_Click( object sender, RoutedEventArgs e )
        {
            if (txtState.Text != "")
            {
                //GeoClient proxy = new GeoClient("httpEP");

                EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                System.ServiceModel.Channels.Binding binding = new NetTcpBinding();

                GeoClient proxy = new GeoClient(binding, address);

                IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text);

                if (data != null)
                {
                    lstZips.ItemsSource = data;
                }

                proxy.Close();
            }
        }
예제 #45
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            if(txtState.Text != "")
            {
                GeoClient proxy = new GeoClient(endpointName);
                IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text);
                if (zipCodeData != null)
                {
                    lstZips.ItemsSource = zipCodeData;
                }
                proxy.Close();

                //EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:11001/GeoService");
                //System.ServiceModel.Channels.Binding binding = new NetTcpBinding();
                //GeoClient proxy = new GeoClient(binding, endpointAddress);
                //IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text);
                //if(zipCodeData!=null)
                //{
                //    lstZips.ItemsSource = zipCodeData;
                //}
                //proxy.Close();
            }
        }
        private void btnOneWay_Click(object sender, RoutedEventArgs e)
        {
            GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            proxy.OneWayExample();

            MessageBox.Show("Oneway example. Back at client");

            proxy.Close();

            MessageBox.Show("Proxy close");
        }
        private async void btnPutBack_Click(object sender, RoutedEventArgs e)
        {
            List<ZipCityData> cityZipList = new List<ZipCityData>()
            {
                new ZipCityData() { ZipCode = "07035", City = "Lincoln Park" },
                new ZipCityData() { ZipCode = "33033", City = "Homestead" },
                new ZipCityData() { ZipCode = "90210", City = "Beverly Hills" },
                new ZipCityData() { ZipCode = "07094", City = "Secaucus" }
            };

            lstZips2.Items.Clear();
            //await Task.Run(() =>
            //{

            //    try
            //    {
            //        GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            //        proxy.UpdateZipCity(cityZipList);

            //        proxy.Close();

            //        MessageBox.Show("Updated.");
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: " + ex.Message);
            //    }
            //});
            GeoClient proxy = new GeoClient(new InstanceContext(this), "tcpEp");

            Task<int> task = proxy.UpdateZipCityAsync(cityZipList);

            task.ContinueWith(result =>
            {
                MessageBox.Show(string.Format("Updated {0} items.", result.Result));
            });
           // MessageBox.Show("Call made");

        }
예제 #48
0
        private void btnGetZipCodes_Click(object sender, RoutedEventArgs e)
        {
            //Here we will do no config for proxy
            //the client little more knowledge of wcf becuase proxy need this programattic end point
            //config info and this is fed through ctor overload.
            if (txtState.Text != null)
            {
                //EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService");
                //NetTcpBinding binding = new NetTcpBinding();
                //binding.Name = "dynamic";
                //binding.MaxReceivedMessageSize = 2000000;
                //GeoClient proxy = new GeoClient(binding, address);

                GeoClient proxy = new GeoClient("tcpEP");

                IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text);
                if (data != null)
                    lstZips.ItemsSource = data;
                proxy.Close();
            }
        }