public void TimeSeriesComparisonGraphSimpleNumericalTest()
        {
            var expected  = new TimeSeries();
            var timestamp = DateTime.Parse("2000-11-24", CultureInfo.InvariantCulture);

            expected.AddMeasurement(new Measurement
            {
                Timestamp = timestamp,
                Value     = "1"
            });
            expected.AddMeasurement(new Measurement
            {
                Timestamp = timestamp.Date.AddSeconds(1),
                Value     = "2"
            });
            var timeseriesComparison = new TimeSeriesComparison(expected, expected);
            var result = timeseriesComparison.GraphX(320, 200);

            TimeSeriesChartTest.AssertChartImage(result, SimpleResultFile, nameof(TimeSeriesComparisonGraphSimpleNumericalTest));
            var parameters = new Dictionary <string, string> {
                { "start timestamp", "2004-03-24" }
            };
            var result2 = timeseriesComparison.Graph(parameters);

            Assert.AreEqual("no data", result2);
        }
        public void TimeSeriesComparisonGraphSecondOrderResponseTest()
        {
            const double zetaExpected  = 0.205;
            const double zetaActual    = 0.2;
            const double omega         = 1;
            const double theta         = Math.PI / 2;
            var          timestampBase = DateTime.Today;
            var          minY          = double.MaxValue;
            var          maxY          = double.MinValue;

            var expected = new TimeSeries();
            var actual   = new TimeSeries();

            for (double time = 0; time <= 31; time += 0.5)
            {
                var timestamp     = timestampBase.AddSeconds(time);
                var expectedValue = TimeSeriesChartTest.SecondOrderResponse(time, zetaExpected, omega, theta);
                var actualValue   = TimeSeriesChartTest.SecondOrderResponse(time, zetaActual, omega, theta);
                if (actualValue > maxY)
                {
                    maxY = actualValue;
                }
                if (actualValue < minY)
                {
                    minY = actualValue;
                }

                var okValue = time < 12 || time > 16 && time <25 || time> 25.5;

                actual.AddMeasurement(new Measurement
                {
                    Timestamp = timestamp,
                    Value     = actualValue.To <string>(),
                    IsGood    = okValue
                });
                expected.AddMeasurement(new Measurement
                {
                    Timestamp = timestamp,
                    Value     = expectedValue.To <string>(),
                    IsGood    = true
                });
            }

            var parameters = new Dictionary <string, string>
            {
                { "Min Value", "0.7" },
                { "Max Value", "1.6" },
                { "start timestamp", timestampBase.ToRoundTripFormat() },
                { "end timestamp", timestampBase.AddSeconds(30).ToRoundTripFormat() }
            };
            var comparison = new TimeSeriesComparison(expected, actual, Tolerance.Parse("1.0"));
            var result     = comparison.Graph(parameters);

            TimeSeriesChartTest.AssertChartImage(result, SecondOrderResponseLimitedYFile, nameof(TimeSeriesComparisonGraphSecondOrderResponseTest));
            parameters.Remove("Min Value");
            parameters.Remove("Max Value");
            var result2 = new TimeSeriesComparison(expected, actual, Tolerance.Parse("1.0")).Graph(parameters);

            TimeSeriesChartTest.AssertChartImage(result2, SecondOrderResponseFile, nameof(TimeSeriesComparisonGraphSecondOrderResponseTest));
        }
        public void TimeSeriesComparisonGraphNoDataTest()
        {
            var comparison = new TimeSeriesComparison(null, null);
            var result     = comparison.Graph();

            Assert.AreEqual(result, "no data");
        }
        public void TimeSeriesComparisonGraphNoNumericalDataTest()
        {
            var expected  = new TimeSeries();
            var timestamp = DateTime.Parse("2000-11-24", CultureInfo.InvariantCulture);

            expected.AddMeasurement(new Measurement
            {
                Timestamp = timestamp,
                Value     = "hi"
            });
            var timeseriesComparison = new TimeSeriesComparison(expected, expected);
            var result = timeseriesComparison.Graph();

            Assert.AreEqual(result, "no numeric comparison");
            Assert.AreEqual(timestamp, timeseriesComparison.BaseTimestamp.DateTime);
            Assert.IsTrue(timeseriesComparison.TimeSpanSeconds.IsZero());
        }
        public void TimeSeriesComparisonGraphEmptyExpectedNumericalTest()
        {
            var expected  = new TimeSeries();
            var actual    = new TimeSeries();
            var timestamp = DateTime.Parse("2000-11-24", CultureInfo.InvariantCulture);

            actual.AddMeasurement(new Measurement
            {
                Timestamp = timestamp,
                Value     = "0"
            });
            var timeseriesComparison = new TimeSeriesComparison(expected, actual);
            var parameters           = new Dictionary <string, string>
            {
                { "Width", "320" },
                { @"heIght", "200" }
            };
            var result = timeseriesComparison.Graph(parameters);

            TimeSeriesChartTest.AssertChartImage(result, MissingExpectedFile, nameof(TimeSeriesComparisonGraphEmptyExpectedNumericalTest));
        }