Esempio n. 1
0
        public void DeleteSelectionInEL68D()
        {
            //2005-02-02 06:53:52.331,98.4335632324219
            //2005-02-04 09:24:53.233,98.4335632324219

            string     fn = Path.Combine(TestData.DataPath, "el68d_export.csv");
            TextSeries s  = new TextSeries(fn);

            s.Read();
            Assert.AreEqual(s.Count, 1145, "Test Data has been modified....expected 1145 records. found " + s.Count);
            DateTime delete1 = Convert.ToDateTime("2005-02-02 06:53:52.331");
            DateTime delete2 = Convert.ToDateTime("2005-02-04 09:24:53.233");

            Assert.AreEqual(186, s.IndexOf(delete1), "test data has been modified could not find " + delete1.ToShortDateString() + " " + delete1.ToLongTimeString());
            Assert.AreEqual(490, s.IndexOf(delete2), "test data has been modified could not find " + delete2.ToShortDateString() + " " + delete2.ToLongTimeString());
            DateTime  t1  = new DateTime(2005, 2, 2);
            DateTime  t2  = new DateTime(2005, 2, 4, 10, 30, 0, 0);
            Selection sel = new Selection(t1, t2, 30, 200);

            s.Delete(sel);// should delete two records in selection.
            Assert.AreEqual(s.Count, 1143, "expected 1143 records. found " + s.Count);


            Assert.AreEqual(-1, s.IndexOf(delete1), "delete1 point was not deleted ");
            Assert.AreEqual(-1, s.IndexOf(delete2), "delete2 point was not deleted ");
        }
Esempio n. 2
0
        public void SubsetByMonth()
        {
            // skip october (10th month)
            int[] months = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12 };

            string path = TestData.DataPath + "\\";
            string fn1  = path + "LuckyPeakWaterLevel.txt";

            Console.WriteLine("reading " + fn1);
            TextSeries s = new TextSeries(fn1);

            s.Read();

            DateTime d = DateTime.Parse("10/1/2004");

            Console.WriteLine(d);
            //10/1/2004	2926.91

            Assert.AreEqual(127, s.IndexOf(d), "test data [DateTime] has changed?");
            Assert.AreEqual(2926.91, s.Lookup(d), "test data [Value] has changed?");
            Series s2 = Reclamation.TimeSeries.Math.Subset(s, months);

            Assert.AreEqual(-1, s2.IndexOf(d), "October 1, 2004 was not removed");
        }