public async Task <ProcessOfferingCollection> DescribeProcess(string wpsUri, params string[] processIdentifiers) { if (wpsUri == null) { throw new ArgumentNullException(nameof(wpsUri)); } if (processIdentifiers == null) { throw new ArgumentNullException(nameof(processIdentifiers)); } if (!processIdentifiers.Any()) { throw new InvalidOperationException("You cannot get the description of an empty list of identifiers."); } var request = new DescribeProcessRequest { Identifiers = processIdentifiers }; var content = await GetRequestResult(wpsUri, request); var result = _serializationService.Deserialize <ProcessOfferingCollection>(content); return(result); }
public void SerializeDescribeProcessRequest_ValidRequestGiven_ShouldPass() { const string expectedXml = @"<?xml version=""1.0"" encoding=""utf-8""?> <wps:DescribeProcess xmlns:ows=""http://www.opengis.net/ows/2.0"" xmlns:xli=""http://www.w3.org/1999/xlink"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" service=""WPS"" version=""2.0.0"" lang=""en-US"" xmlns:wps=""http://www.opengis.net/wps/2.0""> <ows:Identifier>id1</ows:Identifier> <ows:Identifier>id2</ows:Identifier> <ows:Identifier>id3</ows:Identifier> </wps:DescribeProcess>"; // Remove white spaces and new line characters for XML comparison. var trimmedExpectedXml = Regex.Replace(expectedXml, @"\s+", string.Empty); var request = new DescribeProcessRequest() { Identifiers = new[] { "id1", "id2", "id3" }, Language = "en-US", }; var resultXml = _serializer.Serialize(request); var trimmedResult = Regex.Replace(resultXml, @"\s+", string.Empty); trimmedResult.Should().Be(trimmedExpectedXml); }