Beispiel #1
0
        public async void Match_NoMatch_ReturnsStatusNewBook()
        {
            var books = Substitute.For <IFullDataSource>();

            books.GetBooks(true, true).Returns(new BookInfo[] { MakeBook("123", "Title1", "Author1") });
            var matcher = new BookFinder(books);
            var result  = await matcher.Find(MakeBook("456", "Title2", "Author2"));

            Assert.IsNotNull(result);
            Assert.AreEqual(MatchStatus.NewBook, result.Status);
            Assert.IsNull(result.Book);
        }
Beispiel #2
0
 /// <summary>
 /// Finds books by the given tag.
 /// </summary>
 /// <param name="finder">
 /// Subclass of BookFinder class which has tag and value for searching.
 /// This class overrides FindByTag method of BookFinder class which filters list by the given tag.
 /// </param>
 /// <returns>
 /// Filtered list by a tag.
 /// </returns>
 public List <Book> FindBooksByTag(BookFinder finder) => finder.FindByTag(this.Books);
Beispiel #3
0
 public async void Match_Null_ReturnsEmpty()
 {
     var books   = Substitute.For <IFullDataSource>();
     var matcher = new BookFinder(books);
     var result  = await matcher.Find(null);
 }