public void Test_SaveTextAppService_OverHttp_Save() { try { string url = AppSettingsReader <IAppSettings> .Get(x => x.SaveTextAppServiceUrl); string soapAction = "http://tempuri.org/ISaveTextAppService/Save"; byte[] dataToSend = GetBytesToSendFromEmbeddedResource(); //byte[] dataToSend = GetBytesToSendFromViewModel(); HttpWebRequest request = CreateSoapRequest(url, soapAction, dataToSend); using (var response = (HttpWebResponse)request.GetResponse()) { using (Stream responseStream = response.GetResponseStream()) { if (responseStream == null) { throw new NullException(nameof(responseStream)); } using (var reader = new StreamReader(responseStream, Encoding.UTF8)) { string dataReceived = reader.ReadToEnd(); SaveTextViewModel viewModel = ParseReceivedData(dataReceived); } } } } catch (WebException ex) { Assert.Inconclusive(ex.Message); } }
public void Test_ResourceAppService_CustomClient() { try { string url = AppSettingsReader <IAppSettings> .Get(x => x.ResourceAppServiceUrl); string cultureName = "nl-NL"; var client = new ResourceAppServiceClient(url); Labels labels = client.GetLabels(cultureName); Messages messages = client.GetMessages(cultureName); Titles titles = client.GetTitles(cultureName); } catch (WebException ex) { Assert.Inconclusive(ex.Message); } }
public void Test_SaveTextAppService_CustomClient() { try { string url = AppSettingsReader <IAppSettings> .Get(x => x.SaveTextAppServiceUrl); string cultureName = AppSettingsReader <IAppSettings> .Get(x => x.CultureName); var client = new SaveTextAppServiceClient(url, cultureName); SaveTextViewModel viewModel = client.Show(); SaveTextViewModel viewModel2 = client.Save(viewModel); } catch (WebException ex) { Assert.Inconclusive(ex.Message); } }