public void CalculateCoordinates()
        {
            string testData = "date       time    	Air_Temp\tBarometric_Press\tDew_Point\tRelative_Humidity\tWind_Dir\tWind_Gust\tWind_Speed\n"+
                              "2012_01_01 00:02:14\t34.3\t30.5\t26.9\t74.2\t346.4\t11\t3.6\n" +
                              "2012_01_01 00:08:29\t34.1\t30.5\t26.5\t73.6\t349\t12\t8";

            BarometricDataInput bdi = new BarometricDataInput
            {
                InputData = testData
            };

            bdi.InitializeStringReader();
            bdi.ParseData();

            DateTime start = new DateTime(2012, 1, 1, 0, 0, 0);
            DateTime end   = new DateTime(2012, 1, 1, 23, 59, 59);

            BarometricCoordinates bc = new BarometricCoordinates();
            var expectedX1           = new DateTime(2012, 1, 1, 0, 2, 14).ToShortDateString();

            var expectedY1 = (float)30.5;

            bc.CalculateCoordinates(start, end, bdi.Data);
            var result = bc.Coordinates;

            Assert.AreEqual(expectedX1, result[0].X);
            Assert.AreEqual(expectedY1, result[0].Y);
        }
Exemple #2
0
        void CalculateChartData()
        {
            BarometricDataInput bdi = new BarometricDataInput
            {
                InputData = FileContent
            };

            bdi.InitializeStringReader();
            bdi.ParseData();

            BarometricCoordinates bc = new BarometricCoordinates();

            //Test purpose
            var start = new DateTime(2012, 01, 01, 00, 02, 14);
            var end   = new DateTime(2012, 01, 03, 00, 02, 14);

            bc.CalculateCoordinates(start, end, bdi.Data);
            Coordinates = bc.Coordinates;

            (lineChart.Series[0] as LineSeries).ItemsSource = Coordinates;
        }