public MainWindow() { Data data = new Data(); InitializeComponent(); Database.SetInitializer(new CustomInitializer <LibraryDb>()); MaintainDb db = new MaintainDb(); Author jkrow = new Author("Joanne", "Rowling", "Harry Potter's mother"); Book hp1 = new Book("Harry Potter and the Philosopher's Stone", 1, 1997, "English", 223); data.addAuthor(jkrow); data.addBook(hp1); books = data.getBooks(); authors = data.getAuthors(); foreach (Book b in books) { foreach (Author a in authors) { if (b.authorId == a.id) { bookWithAuthor = new BookAuthor(b, a); System.Console.WriteLine(bookWithAuthor.Id + " " + bookWithAuthor.Title); DataContext = bookWithAuthor; } } } }
public LibraryTests() { szymi = new Librarian("Szymon", "Rogalski", 3500, 1, new DateTime(1997, 01, 07)); bartolus = new Librarian("Bartek", "Rogalski", 3500, 1, new DateTime(1997, 01, 07)); storage = new LibrarySolution.Data(); maintainDb = new MaintainDb(); Database.SetInitializer(new CustomInitializer <LibraryDb>()); storage.addLibrarian(szymi); storage.addLibrarian(bartolus); }