public void TestAddChapters() { var book = new Book("A", "ON", 2000, 260); book.AddChapter("Abc"); book.AddChapter("Cde"); Assert.AreEqual(2, book.ChapterCount); }
public void TestSearchForChapterInBook() { var book = new Book("A", "ON", 2000, 260); book.AddChapter("en to tre fire"); book.AddChapter("tre fire fem seks"); var result = book.SearchChapters("tre"); Assert.AreEqual(2, result.Length); Assert.AreEqual("en to tre fire", result[0]); Assert.AreEqual("tre fire fem seks", result[1]); }
public void TestSearch() { var library = new Library(); var book1 = new Book("A", "ON", 2000, 260); book1.AddChapter("en to tre fire"); book1.AddChapter("tre fire fem seks"); library.AddBook(book1); var book2 = new Book("B", "PN", 2000, 260); book2.AddChapter("en tre "); book2.AddChapter("tre fem "); library.AddBook(book2); library.SearchBooksAndChapters("tre"); }
private IEnumerable <Book> GenerateBooks() { var identity = WindowsIdentity.GetCurrent(); //We can get an information of GetCurrent an then use it var books = new List <Book>(); for (int i = 0; i < 10; i++) { var book = new Book() { Id = Guid.NewGuid(), Title = "Book" + i, Isbn = i + "isbn", Pages = i * 10, CreationDate = DateTime.Now, ModificationDate = DateTime.Now, UserCode = identity.User.Value, Version = 1 }; var chart = new Chapter() { Id = Guid.NewGuid(), BookId = book.Id, Title = "Chapter of Book " + book.Title, CreationDate = DateTime.Now, ModificationDate = DateTime.Now, UserCode = WindowsIdentity.GetCurrent().User.Value //we get the user directly from WindowsIdentity }; book.AddChapter(chart); books.Add(book); } return(books); }
public void TestMethod1() { var book = new Book("Working Title"); book.AddChapter(new Chapter()); }