//The constructor will find the paths of the 6 XML files for serialization at Close.
 public DataManager()
 {
     PeopleXMLPath       = XMLFileFinder.FindPath("People.xml");
     AuthorsXMLPath      = XMLFileFinder.FindPath("Authors.xml");
     CardholdersXMLPath  = XMLFileFinder.FindPath("Cardholders.xml");
     LibrariansXMLPath   = XMLFileFinder.FindPath("Librarians.xml");
     CheckOutLogsXMLPath = XMLFileFinder.FindPath("CheckOutLog.xml");
     BooksXMLPath        = XMLFileFinder.FindPath("Books.xml");
 }
示例#2
0
        public void TestXMLCardholders()
        {
            //Arrange
            int              databaseRows = 0;
            int              xmlObjects;
            string           path;
            XMLListRetriever lists = new XMLListRetriever();

            //Act
            path = XMLFileFinder.FindPath("Cardholders.xml");
            lists.GetCardholderCodeFirstsFromXDocument(path);
            xmlObjects = lists.Cardholders.Count;

            using (LibraryDBEntities context = new LibraryDBEntities())
            {
                foreach (Cardholder c in context.Cardholders)
                {
                    databaseRows++;
                }
            }

            //Assert
            Assert.AreEqual(databaseRows, xmlObjects);
        }