示例#1
0
        public async Task ThrowBookException_WhenPublishDateIsIncorrect_Test()
        {
            var publishDate = "TestDate";

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

            using (var actContext = new LibrarySystemContext(options))
            {
                await actContext.Books.AddAsync(new Book { PublishDate = "Other Date" });

                await actContext.SaveChangesAsync();
            }

            using (var assertContext = new LibrarySystemContext(options))
            {
                var sut        = new BookWebService(assertContext);
                var bookSearch = await sut.SearchBookAsync(null, null, null, publishDate);
            }
        }
示例#2
0
        public async Task SearchBookByPublishDate_Test()
        {
            var publishDate = "TestDate";

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

            using (var actContext = new LibrarySystemContext(options))
            {
                await actContext.Books.AddAsync(new Book { PublishDate = publishDate });

                await actContext.SaveChangesAsync();
            }

            using (var assertContext = new LibrarySystemContext(options))
            {
                var sut        = new BookWebService(assertContext);
                var bookSearch = await sut.SearchBookAsync(null, null, null, publishDate);

                Assert.IsNotNull(bookSearch);
            }
        }