예제 #1
0
파일: Test.cs 프로젝트: sudeepcb/textbox
        public void TestGenre()
        {
            LibraryModel lm = new LibraryModel();
            Book         b1 = new Book();
            Book         b2 = new Book();

            b1.BookGenres = new List <BookGenres>();
            b2.BookGenres = new List <BookGenres>();

            BookGenres bg1 = new BookGenres();
            Genre      g1  = new Genre();

            g1.GenreName = "testGenre";
            bg1.Genres   = g1;

            BookGenres bg2 = new BookGenres();
            Genre      g2  = new Genre();

            g2.GenreName = "Sci-Fi";
            bg2.Genres   = g2;

            b1.BookGenres.Add(bg1);
            b2.BookGenres.Add(bg2);

            lm.library = new List <Book>();
            List <Book> Expectedlib = new List <Book>();

            lm.library.Add(b1);
            lm.library.Add(b2);

            Expectedlib.Add(b1);

            lm.SearchGenre("Sci-Fi");

            Assert.NotNull(lm.library);
            Assert.IsType <List <Book> >(lm.library);
            Assert.True(Expectedlib.Any() == lm.library.Any());
        }