You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.2 KiB

using System;
using Model;
namespace TestDataManager;
public class TestData_WithTheoryDataAndMemberData4
{
public static IEnumerable<object[]> GetTestData_BorrowBook(bool expectedResult)
{
var testData = new TheoryData<bool, Book, Person, IDataManager>
{
//T1. no book and no borrower
{ false, null, null, new BorrowBookStub() },
//T2. no book
{ false, null, new Person("John", "Coltrane"), new BorrowBookStub() },
//T3. no borrower
{ false, new Book( "Les Pardaillan", "Michel Zévaco", "978-2221098417"), null, new BorrowBookStub() },
//T4. new book and new borrower
{ false, new Book( "Les Pardaillan", "Michel Zévaco", "978-2221098417"), new Person("John", "Coltrane"), new BorrowBookStub() },
//T5. new book and already known borrower
{ false, new Book( "Les Pardaillan", "Michel Zévaco", "978-2221098417"), new Person(1, "Chick", "Corea"), new BorrowBookStub() },
//T6. already known but free book and new borrower
{ false, new Book(2, "Les Misérables", "Victor Hugo", "979-8850172916"), new Person("John", "Coltrane"), new BorrowBookStub() },
//T7. already known but already borrowed book and new borrower
{ false, new Book(1, "Les Trois Mousquetaires", "Alexandre Dumas", "979-8415441792"), new Person("John", "Coltrane"), new BorrowBookStub() },
//T8. already known but free book and already known borrower
{ true, new Book(2, "Les Misérables", "Victor Hugo", "979-8850172916"), new Person(1, "Chick", "Corea"), new BorrowBookStub() },
//T9. already known but already borrowed book by another borrower and already known borrower
{ false, new Book(1, "Les Trois Mousquetaires", "Alexandre Dumas", "979-8415441792"), new Person(2, "Stanley", "Clarke"), new BorrowBookStub() },
//T10. already known but already borrowed book by this borrower and already known borrower
{ true, new Book(1, "Les Trois Mousquetaires", "Alexandre Dumas", "979-8415441792"), new Person(1, "Chick", "Corea"), new BorrowBookStub() },
};
return testData.Where(data => (bool)data[0] == expectedResult);
}
}