public void P2000AlarmGetListExRequestWrapperConstructorTest()
        {
            const string xml = @"
                <P2000Request>
                  <AlarmGetListExRequest>
                    <AlarmFilter>
                      <Partition>
                        <CV>Super User</CV>
                      </Partition>
                      <AlarmGuid>
                        <CV>235337E0-B192-4259-82AE-C0D10C64C831</CV>
                      </AlarmGuid>
                      <AlarmSiteName>
                        <CV>Site 1</CV>
                      </AlarmSiteName>
                      <AlarmTypeName>
                        <CV>Alarm Type 1</CV>
                      </AlarmTypeName>
                      <ItemName>
                        <CV>Item 1</CV>
                      </ItemName>
                      <OperatorName>
                        <CV>Operator 1</CV>
                      </OperatorName>
                    </AlarmFilter>
                    <RecordsPerPage>50</RecordsPerPage>
                    <SortOrder>
                        <SortKeys>
                            <SortKey SequenceNumber=""1"">
                            <Name>AlarmTimeStamp</Name>
                            </SortKey>
                        </SortKeys>
                        <Order>ASC</Order> 
                    </SortOrder>
                  </AlarmGetListExRequest>
                </P2000Request>";

            P2000AlarmGetListExRequestWrapper expected = (new XmlSerializer<P2000AlarmGetListExRequestWrapper>()).Deserialize(xml);
            var actual =
                new P2000AlarmGetListExRequestWrapper(
                    new AlarmGetListExRequest(
                        new AlarmFilter("Super User", "235337E0-B192-4259-82AE-C0D10C64C831", "Site 1", "Alarm Type 1", "Item 1", "Operator 1"),
                        "50",
                        new SortOrder(new[] { new SortKey("1", "AlarmTimeStamp", null, null) }, "ASC")));

            DtoAssert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Invokes the AlarmGetListEx service on the P2000 to retrieve the current list of active alarms.
        /// </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="partition">Name of the Partition to filter on</param>
        /// <param name="alarmGuid">GUID (Alarm.ItemGuid) of the Alarm to be returned</param>
        /// <param name="alarmSiteName">Name of the Site to filter on</param>
        /// <param name="alarmTypeName">Name of the Alarm Type to filter on</param>
        /// <param name="itemName">Name of the Item associated with the Alarm(s) to filter on</param>
        /// <param name="operatorName">Name of the Operator who updated the Alarm(s) to filter on</param>
        /// <param name="recordsPerPage">Number of Records Per Page to be returned</param>
        /// <param name="sortOrder">A SortOrder object containing an array of SortKeys, and the sort Order</param>
        /// <returns>AlarmGetListExReply object containing the deserialized list of Alarms</returns>
        public AlarmGetListExReply AlarmGetListEx(string userName, string sessionGuid, string partition, string alarmGuid, string alarmSiteName, string alarmTypeName, string itemName, string operatorName, int recordsPerPage, SortOrder sortOrder)
        {
            if (userName == null) throw new ArgumentNullException("userName");
            if (sessionGuid == null) throw new ArgumentNullException("sessionGuid");

            var alarmGetListExRequest =
                new P2000AlarmGetListExRequestWrapper(
                    new AlarmGetListExRequest(
                        new AlarmFilter(partition, alarmGuid, alarmSiteName, alarmTypeName, itemName, operatorName),
                        recordsPerPage.ToString(CultureInfo.InvariantCulture), sortOrder));
            string xmlDoc = (new XmlSerializer<P2000AlarmGetListExRequestWrapper>()).Serialize(alarmGetListExRequest);
            P2000ReturnStructure response = _alarmServiceProxy.Invoke(proxy => proxy.AlarmGetListEx(userName, sessionGuid, xmlDoc));

            return
                (new XmlSerializer<P2000AlarmGetListExReplyWrapper>()).Deserialize(response.XmlDoc).AlarmGetListExReply;
        }