public void DeserializeWithAllElementsPresent() { // Arrange var expected = new P2000AlarmGetResponseTextListRequest(new AlarmGetResponseTextListRequest(new AlarmResponseTextFilter("Partition1"), new Paging(5, 50, 500), new SortOrder(new[] { new SortKey("1", "Column1", null, null) }))); const string requestObj = @" <P2000Request> <AlarmGetResponseTextListRequest> <AlarmResponseTextFilter> <Partition> <CV>Partition1</CV> </Partition> </AlarmResponseTextFilter> <Paging> <Page>5</Page> <RecordsPerPage>50</RecordsPerPage> <RecordCount>500</RecordCount> </Paging> <SortOrder> <SortKeys> <SortKey SequenceNumber=""1""> <Name>Column1</Name> </SortKey> </SortKeys> <Order>DESC</Order> </SortOrder> </AlarmGetResponseTextListRequest> </P2000Request>"; // Act var actual = _requestSerializer.Deserialize(requestObj); // Assert DtoAssert.AreEqual(expected, actual); }
public void GetResponseTextList() { // Arrange var expected = new AlarmGetResponseTextListRequest(null, null, new SortOrder(new[] { new SortKey("1", "Field1", null, null) })); var requestObj = new P2000AlarmGetResponseTextListRequest(new AlarmGetResponseTextListRequest(null, null, new SortOrder(new[] { new SortKey("1", "Field1", null, null) }))); // Act var actual = requestObj.AlarmGetResponseTextListRequest; // Assert DtoAssert.AreEqual(expected, actual); }
public void ConstructorAllMembersTest() { // Arrange var expected = new AlarmGetResponseTextListRequest(new AlarmResponseTextFilter("Partition1"), new Paging(5, 50, 500), new SortOrder(new[] {new SortKey("1", "SortKeyName", "StartKey", "LastKey")}, "ASC")); var getResponseTextObject = new P2000AlarmGetResponseTextListRequest(expected); // Act var actual = getResponseTextObject.AlarmGetResponseTextListRequest; // Assert DtoAssert.AreEqual(expected, actual); }
/// <summary> /// This function is provided clients to obtain a list of the response texts in the P2000 system. For performance reasons /// and to limit the impact of the server, this function supports paging. /// </summary> /// <param name="userName">The P2000 username associated with the specified session GUID</param> /// <param name="sessionGuid">Client’s P2000 session GUID</param> /// <param name="sortOrder">A SortOrder object containing an array of SortKeys, and the sort Order</param> /// <param name="paging">A Paging object containing the number of records per page, and page number being requested</param> /// <returns></returns> /// <exception cref="ArgumentNullException">Thrown if any argument is passed in as null.</exception> /// <exception cref="ServiceOperationException">Thrown if a Fault Code is returned by the RPC Server /// or if there are any <see cref="WebException"/> while trying to contact the XML-RPC Server. /// Captured exceptions will be included as an inner exception.</exception> public AlarmGetResponseTextListReply AlarmGetResponseTextList(string userName, string sessionGuid, SortOrder sortOrder, Paging paging) { if (userName == null) throw new ArgumentNullException("userName"); if (sessionGuid == null) throw new ArgumentNullException("sessionGuid"); // Create default Request object with Paging "Turned off" var alarmRequest = new P2000AlarmGetResponseTextListRequest( new AlarmGetResponseTextListRequest { Filter = new AlarmResponseTextFilter(), Paging = paging, SortOrder = sortOrder }); // Serialize the request object string xmlDoc = XmlSerializer<P2000AlarmGetResponseTextListRequest>.Instance.Serialize(alarmRequest); // Call the P2000, and get back a Serialized response within the returned string var responseStructure = _alarmServiceProxy.Invoke(proxy => proxy.AlarmGetResponseTextList(userName, sessionGuid, xmlDoc)); // Deserialize the response into the P2000AlarmGetResponseTextListReply structure. var responseObj = XmlSerializer<P2000AlarmGetResponseTextListReply>.Instance.Deserialize(responseStructure.XmlDoc); return responseObj.AlarmGetResponseTextListReply; }
public void DeserializeWithEmptyP2000GetResponseTextListRequestElementPresent() { // Arrange var expected = new P2000AlarmGetResponseTextListRequest(); const string xml = @"<P2000Request> </P2000Request>"; // Act var actual = _requestSerializer.Deserialize(xml); // Assert DtoAssert.AreEqual(expected, actual); }