コード例 #1
0
        private void ReadRecords(List <Type> records, Stream stream)
        {
            StdfFileReader reader = null;

            try
            {
                reader = new StdfFileReader(stream);
                foreach (Type recordType in records)
                {
                    StdfRecord record = reader.ReadRecord();
                    Assert.IsInstanceOf(recordType, record);
                }
            }
            catch (StdfException e)
            {
                Console.WriteLine(e.StackTrace);
                Assert.Fail(e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
コード例 #2
0
        public void TestWriting()
        {
            InitializeTestRecord();
            MockStdfFileWriter writer = new MockStdfFileWriter(CpuType.Sun386);

            writer.WriteRecord(hbr);
            writer.Reset();
            StdfFileReader reader = new StdfFileReader(writer.Stream);
            StdfRecord     record = reader.ReadRecord();

            Assert.IsInstanceOf(typeof(FarRecord), record);
            record = reader.ReadRecord();
            Assert.IsInstanceOf(typeof(HbrRecord), record);
            HbrRecord readRecord = record as HbrRecord;

            Assert.IsNotNull(readRecord);
            Assert.AreEqual(hbr.HeadNumber, readRecord.HeadNumber);
            Assert.AreEqual(hbr.SiteNumber, readRecord.SiteNumber);
            Assert.AreEqual(hbr.Name, readRecord.Name);
            Assert.AreEqual(hbr.Number, readRecord.Number);
            Assert.AreEqual(hbr.PartsCount, readRecord.PartsCount);
            Assert.AreEqual(hbr.PassFail, readRecord.PassFail);
        }