Пример #1
0
        public void TestOpenFile()
        {
            RecordReader record;

            record = new RecordReader(@"Resources\sample_ascii.dat");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_bin.DAT");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_ascii.cFg");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_bin.cfg");

            //record=new RecordReader(@"D:\YandexDisk\Oscillogram\Sepam_StopingGenerator_B\1.DAT");
            //record.GetTimeLine();
            //record.GetAnalogPrimaryChannel(0);
            //record.GetDigitalChannel(0);

            //record=new RecordReader(@"D:\YandexDisk\Oscillogram\Undefined_2013_B32\000.DAT");
            //record.GetTimeLine();
            //record.GetAnalogPrimaryChannel(0);
            //record.GetDigitalChannel(0);
        }
        private void ReaderAsserts(string fullpath)
        {
            var reader = new RecordReader(fullpath);

            Assert.That(reader.Configuration.AnalogChannelInformationList.Count, Is.EqualTo(3));
            Assert.That(reader.Configuration.DigitalChannelInformationList.Count, Is.EqualTo(17));

            var timeLine   = reader.GetTimeLine();
            var analogs1   = reader.GetAnalogPrimaryChannel(0);
            var analogs2   = reader.GetAnalogPrimaryChannel(1);
            var analogs3   = reader.GetAnalogPrimaryChannel(2);
            var digitals1  = reader.GetDigitalChannel(0);
            var digitals5  = reader.GetDigitalChannel(4);
            var digitals17 = reader.GetDigitalChannel(16);


            Assert.That(timeLine[0], Is.EqualTo(0).Within(0.01));
            Assert.That(timeLine[1], Is.EqualTo(500).Within(0.01));
            Assert.That(timeLine[2], Is.EqualTo(1000).Within(0.01));

            Assert.That(analogs1[0], Is.EqualTo(0).Within(0.01));
            Assert.That(analogs1[1], Is.EqualTo(1.0).Within(0.01));
            Assert.That(analogs1[2], Is.EqualTo(-1.0).Within(0.01));

            Assert.That(analogs2[0], Is.EqualTo(0).Within(0.01));
            Assert.That(analogs2[1], Is.EqualTo(2.0).Within(0.01));
            Assert.That(analogs2[2], Is.EqualTo(2.0).Within(0.01));

            Assert.That(analogs3[0], Is.EqualTo(0).Within(0.01));
            Assert.That(analogs3[1], Is.EqualTo(3.0).Within(0.01));
            Assert.That(analogs3[2], Is.EqualTo(-3.5).Within(0.01));

            Assert.That(digitals1[0], Is.EqualTo(true));
            Assert.That(digitals1[1], Is.EqualTo(false));
            Assert.That(digitals1[2], Is.EqualTo(false));

            Assert.That(digitals5[0], Is.EqualTo(true));
            Assert.That(digitals5[1], Is.EqualTo(false));
            Assert.That(digitals5[2], Is.EqualTo(true));

            Assert.That(digitals17[0], Is.EqualTo(true));
            Assert.That(digitals17[1], Is.EqualTo(false));
            Assert.That(digitals17[2], Is.EqualTo(true));

            Assert.That(reader.Configuration.StartTime, Is.EqualTo(new DateTime(1234567890)));
            Assert.That(reader.Configuration.TriggerTime, Is.EqualTo(new DateTime(1234569000)));
        }
        public void TestOpenFile()
        {
            RecordReader record;

            record = new RecordReader(@"Resources\sample_ascii.dat");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_bin.DAT");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_ascii.cFg");
            record.GetTimeLine();
            record.GetAnalogPrimaryChannel(0);
            record.GetDigitalChannel(0);

            record = new RecordReader(@"Resources\sample_bin.cfg");
        }