示例#1
0
        public void GEDCOMDocument_Load_Throws_If_GEDCOMReader_Parameter_IsNull()
        {
            GEDCOMReader reader   = null;
            var          document = new GEDCOMDocument();

            //Assert
            Assert.Throws <ArgumentNullException>(() => document.Load(reader));
        }
示例#2
0
        public void GEDCOMDocument_Load_Throws_If_Stream_Parameter_IsNull()
        {
            Stream s        = GetEmbeddedFileStream("InvalidFileName");
            var    document = new GEDCOMDocument();

            //Assert
            Assert.Throws <ArgumentNullException>(() => document.Load(s));
        }
        private void LoadDocument()
        {
            _document = new GEDCOMDocument();

            using (var stream = new FileStream(_path, FileMode.Open, FileAccess.Read))
            {
                _document.Load(stream);
            }
        }
        private int GetIndividualCount(string file)
        {
            string fileName   = Path.Combine(FilePath, file);
            Stream testStream = new FileStream(fileName, FileMode.Open);
            var    doc        = new GEDCOMDocument();

            doc.Load(testStream);

            return(doc.IndividualRecords.Count);
        }
示例#5
0
        public void GEDCOMDocument_Load_Loads_Document_With_Header_If_Document_Is_WellFormed(string fileName)
        {
            //Arrange
            var document = new GEDCOMDocument();

            //Act
            using (Stream s = GetEmbeddedFileStream(fileName))
            {
                document.Load(new StreamReader(s));
            }

            GEDCOMAssert.IsValidHeader(document.SelectHeader());
            GEDCOMAssert.HeaderIsEqual(Util.CreateHeaderRecord(fileName), document.SelectHeader());
        }
示例#6
0
        public void GEDCOMDocument_Load_Loads_Document_With_Individuals_Using_TextReader(string fileName, int recordCount)
        {
            //Arrange
            var document = new GEDCOMDocument();

            //Act
            using (Stream s = GetEmbeddedFileStream(fileName))
            {
                document.Load(new StreamReader(s));
            }

            //Assert
            Assert.AreEqual(recordCount, document.IndividualRecords.Count);
        }