//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);
        }
Пример #3
0
        public void XMLRecipesDescendentsShouldMatchDatabaseRows()
        {
            RecipesContext context               = new RecipesContext();
            int            dbRecipesRows         = context.Recipes.Count();
            int            xmlRecipesDescendants = RecipesContextInitializer.GetRecipeDataFromXDocument(XMLFileFinder.GetXMLRecipesPath()).Count;

            Assert.AreEqual(dbRecipesRows, xmlRecipesDescendants);
        }