public void GetEndTest()
        {
            string desiredUnits   = null;
            string selectedFields = null;
            var    response       = instance.GetEnd(webId, desiredUnits, selectedFields);

            Assert.IsInstanceOf <PITimedValue>(response, "response is PITimedValue");

            AFValue value     = point.EndOfStream();
            float   afValue   = value.ValueAsSingle();
            float   piwaValue = Convert.ToSingle(response.Value);

            Assert.IsTrue(afValue == piwaValue);
        }
        public void GetValueTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string time           = "*-2d";
            string timeZone       = null;
            string desiredUnits   = null;
            string selectedFields = null;
            var    response       = instance.GetValue(webId: webId, time: time, timeZone: timeZone, desiredUnits: desiredUnits, selectedFields: selectedFields);

            Assert.IsInstanceOf <PITimedValue>(response, "response is PITimedValue");

            AFValue value     = point.RecordedValue(new AFTime(time));
            float   afValue   = value.ValueAsSingle();
            float   piwaValue = Convert.ToSingle(response.Value);

            Assert.IsTrue(afValue == piwaValue);
        }
        private int CompareAFValue(AFValue val1, AFValue val2)
        {
            if (val1.ValueTypeCode != val2.ValueTypeCode)
            {
                throw new InvalidOperationException("Types of inputs do not match");
            }

            if (val1.ValueTypeCode == TypeCode.Double)
            {
                return(val1.ValueAsDouble().CompareTo(val2.ValueAsDouble()));
            }
            else if (val1.ValueTypeCode == TypeCode.Single)
            {
                return(val1.ValueAsSingle().CompareTo(val2.ValueAsSingle()));
            }
            else if (val1.ValueTypeCode == TypeCode.Int32)
            {
                return(val1.ValueAsInt32().CompareTo(val2.ValueAsInt32()));
            }
            else
            {
                throw new InvalidOperationException(string.Format("Cannot compare type {0}", val1.ValueType.Name));
            }
        }