Пример #1
0
        public async Task ThrowBookExeptionInvalidInputAddBook_Test(string isbn, string title)
        {
            var pages       = 300;
            var subject     = "TestSubject";
            var publishers  = "TestPublishers";
            var publishDate = "TestPublishDate";
            var author      = "TestAuthor";
            var picture     = "TestPicture";

            var options = TestUtilities.GetOptions(nameof(ThrowBookExeptionInvalidInputAddBook_Test));

            using (var actContext = new LibrarySystemContext(options))
            {
                var sut  = new BookWebService(actContext);
                var book = await sut.CreateBookAsync(isbn, title, pages, subject, publishers, publishDate, author, picture);
            }
        }
Пример #2
0
        public async Task AddBook_Test()
        {
            var isbn        = "00-23-56-43";
            var title       = "TestTitle";
            var pages       = 300;
            var subject     = "TestSubject";
            var publishers  = "TestPublishers";
            var publishDate = "TestPublishDate";
            var author      = "TestAuthor";
            var picture     = "TestPicture";

            var options = TestUtilities.GetOptions(nameof(AddBook_Test));

            using (var actContext = new LibrarySystemContext(options))
            {
                var sut  = new BookWebService(actContext);
                var book = await sut.CreateBookAsync(isbn, title, pages, subject, publishers, publishDate, author, picture);

                Assert.IsNotNull(book);
                Assert.AreEqual(1, actContext.Books.Count());
            }
        }