public void P2000AlarmDetailsRequestWrapperConstructorTest()
        {
            const string xml = @"
                <P2000Request>
                  <AlarmDetailsRequest>
                    <AlarmDetailsFilter>
                      <AlarmGuid>
                        <CV>235337E0-B192-4259-82AE-C0D10C64C831</CV>
                      </AlarmGuid>
                    </AlarmDetailsFilter>
                  </AlarmDetailsRequest>
                </P2000Request>
            ";

            P2000AlarmDetailsRequestWrapper expected = (new XmlSerializer<P2000AlarmDetailsRequestWrapper>()).Deserialize(xml);
            var actual =
                new P2000AlarmDetailsRequestWrapper(
                    new AlarmDetailsRequest(
                        new AlarmDetailsFilter("235337E0-B192-4259-82AE-C0D10C64C831"), null, null));

            DtoAssert.AreEqual(expected, actual);
        }
Exemple #2
0
        /// <summary>
        /// Invokes the AlarmDetails method on the P2000 to retrieve the list of details for a given alarm.
        /// </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="alarmGuid">GUID (Alarm.ItemGuid) of the AlarmDetails to be returned</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>
        /// AlarmDetailsReply object containing the details and history of the Alarm with the
        /// specified GUID.
        /// </returns>
        public AlarmDetailsReply AlarmDetails(string userName, string sessionGuid, string alarmGuid, int recordsPerPage, SortOrder sortOrder)
        {
            if (userName == null) throw new ArgumentNullException("userName");
            if (sessionGuid == null) throw new ArgumentNullException("sessionGuid");
            if (alarmGuid == null) throw new ArgumentNullException("alarmGuid");

            var alarmDetailRequest =
                new P2000AlarmDetailsRequestWrapper(new AlarmDetailsRequest(new AlarmDetailsFilter(alarmGuid), recordsPerPage.ToString(CultureInfo.InvariantCulture),
                                                                            sortOrder));

            string xmlDoc = (new XmlSerializer<P2000AlarmDetailsRequestWrapper>()).Serialize(alarmDetailRequest);

            P2000ReturnStructure response = _alarmServiceProxy.Invoke(proxy => proxy.AlarmDetails(userName, sessionGuid, xmlDoc));

            return (new XmlSerializer<P2000AlarmDetailsReplyWrapper>()).Deserialize(response.XmlDoc).AlarmDetailsReply;
        }