public void bookSetup() { repo = new BookRepo(); testBook = new BOOK(); DateTime dt = DateTime.Now; long a = dt.Ticks; testBook = new BOOK(); testBook.BOOK_ID = 1; testBook.BOOK_TITLE = "Fundamentals of Human Resource Management"; testBook.BOOK_EDITION = 10; testBook.BOOK_DESC = "An intorduction to Human Resource Management"; testBook.BOOK_PUBLISHER = "New York"; testBook.BOOK_AUTHOR = "David A. Decenzo"; testBook.BOOK_PRICE = 25; testBook.CATEGORY_ID = 1; testBook.CONDITION_ID = 1; testBook.USER_ID = 1; testBook.CREATED_TIMESTAMP = BitConverter.GetBytes(a); repo.add(testBook); testBook = new BOOK(); testBook.BOOK_ID = 2; testBook.BOOK_TITLE = "Algebra"; testBook.BOOK_EDITION = 8; testBook.BOOK_DESC = "A Graphical approach to Algebra"; testBook.BOOK_PUBLISHER = "New York"; testBook.BOOK_AUTHOR = "Stephen P. Robbins"; testBook.BOOK_PRICE = 28; testBook.CATEGORY_ID = 1; testBook.CONDITION_ID = 1; testBook.USER_ID = 1; testBook.CREATED_TIMESTAMP = BitConverter.GetBytes(a); repo.add(testBook); }
public Books insertBooks(Books newBook) { Books book2add = newBook; BOOK u3 = new BOOK(); BookRepo bookRepo = new BookRepo(); u3.BOOK_TITLE = book2add.BOOK_TITLE; u3.BOOK_EDITION = book2add.BOOK_EDITION; u3.BOOK_DESC = book2add.BOOK_DESC; u3.BOOK_AUTHOR = book2add.BOOK_AUTHOR; u3.BOOK_PUBLISHER = book2add.BOOK_PUBLISHER; u3.BOOK_PRICE = book2add.BOOK_PRICE; u3.CATEGORY_ID = book2add.CATEGORY_ID; u3.CONDITION_ID = book2add.CONDITION_ID; u3.USER_ID = book2add.USER_ID; u3.CREATED_TIMESTAMP = DateTime.Now; bookRepo.add(u3); return book2add; }
public void bookTest() { book = repo.getById(new BOOK { BOOK_ID = 1 }); Assert.AreEqual(testBook.BOOK_TITLE, book.BOOK_TITLE); book.BOOK_TITLE = "Test Book Title"; repo.update(book); testBook = repo.getById(new BOOK { BOOK_ID = 1 }); Assert.AreEqual(testBook.BOOK_TITLE, book.BOOK_TITLE); book.BOOK_TITLE = "Another Test Title"; repo.update(book); IEnumerable<BOOK> results = (IEnumerable<BOOK>)repo.query(t => t.BOOK_ID == book.BOOK_ID); foreach (BOOK p in results) { if (p.BOOK_ID == book.BOOK_ID) { Assert.AreEqual(testBook.BOOK_TITLE, book.BOOK_TITLE); } } }
public void bookSetup() { bookService = new BookService(); bRepo = new BookRepo(); uRepo = new UserRepo(); userA = new USER { USER_FNAME = "Cory", USER_LNAME = "Jenkings", PASSWORD = "******", USER_EMAIL = "*****@*****.**", USER_DISPLAYNAME = "C.J", CREATED_TIMESTAMP = DateTime.Now, REPUTATION = 509}; uRepo.add(userA); bookA = new BOOK { USER_ID=333, BOOK_PRICE = 20, BOOK_PUBLISHER = "idk", BOOK_TITLE = "my life", BOOK_AUTHOR = "Ermin", BOOK_EDITION = 10, BOOK_DESC = "A book with words and pictures", CREATED_TIMESTAMP = DateTime.Now, ISBN10 = 1111111111, ISBN13 = 1111111111111, CATEGORY_ID=1, CONDITION_ID=1 }; bRepo.add(bookA); }
public void cleanUp() { book = repo.getById(new BOOK { BOOK_ID = 1 }); repo.remove(book); book = repo.getById(new BOOK { BOOK_ID = 1 }); Assert.AreEqual(null, book); book = repo.getById(new BOOK { BOOK_ID = 2 }); repo.remove(book); book = repo.getById(new BOOK { BOOK_ID = 2 }); Assert.AreEqual(null, book); }
public void setup() { bRepo = new BookRepo(); uRepo = new UserRepo(); userA = new USER { USER_FNAME = "Ermin", USER_LNAME = "Avdagic", USER_DISPLAYNAME = "Me", USER_EMAIL = "*****@*****.**", PASSWORD = "******", REPUTATION = 1, CREATED_TIMESTAMP = DateTime.Now }; uRepo.add(userA); bookA = new BOOK { USER_ID=333, BOOK_AUTHOR = "Me", BOOK_DESC = "About my life", BOOK_EDITION = 10, BOOK_PRICE = 20, BOOK_PUBLISHER = "IDK", BOOK_TITLE = "My Life", ISBN10 = 12345678910, ISBN13 = 12345678910111, CREATED_TIMESTAMP = DateTime.Now, CATEGORY_ID=1, CONDITION_ID=1 }; bRepo.add(bookA); uRepo.add(new USER { USER_FNAME = "Jon", USER_LNAME = "Smith", USER_EMAIL = "*****@*****.**", USER_DISPLAYNAME = "JonSmith", REPUTATION = 5, PASSWORD = "******", CREATED_TIMESTAMP = DateTime.Now }); }