Opc.Ua.ServerTest.MonitoredItemTest.CheckReturnedValues C# (CSharp) Метод

CheckReturnedValues() приватный Метод

Checks that the correct values were returned.
private CheckReturnedValues ( MonitoredItem monitoredItem, TestVariable variable, IList notifications ) : bool
monitoredItem Opc.Ua.Client.MonitoredItem
variable TestVariable
notifications IList
Результат bool
        private bool CheckReturnedValues(MonitoredItem monitoredItem, TestVariable variable, IList<Notification> notifications)
        {
            // ignore values if syntax errors occurred.
            if (variable.WriteError)
            {
                return true;
            }

            for (int ii = 0; ii < notifications.Count; ii++)
            {
                bool match = false;

                for (int jj = 0; jj < variable.Values.Count; jj++)
                {
                    // must match any value change during the sampling period.
                    if (variable.Timestamps[jj] < notifications[ii].Timestamp.AddMilliseconds(-monitoredItem.Status.SamplingInterval-(2*m_publishingTime)-m_maximumTimingError))
                    {
                        continue;
                    }
                    
                    // cannot match values after the time of notification.
                    if (variable.Timestamps[jj] >= notifications[ii].Timestamp)
                    {
                        match = false;
                        break;
                    }
                    
                    // check for match.
                    match = m_comparer.CompareVariant(variable.Values[jj].WrappedValue, notifications[ii].Value.WrappedValue);

                    if (match)
                    {
                        break;
                    }
                }

                if (!match)
                {
                    Log(
                        "Value does not match written value for MonitoredItem {0}. NodeId={1}, SamplingInterval={2}, Actual={3}",
                        variable.Variable,
                        variable.Variable.NodeId,
                        monitoredItem.SamplingInterval,
                        notifications[ii].Value.WrappedValue);
                    
                    return false;
                }
            }

            return true;
        }
        #endregion