public ReviewServiceTest() { goodBooksContext = GetDbContext(); mapper = GetMapper(); reviewService = new ReviewService(goodBooksContext, mapper); }
public BookServiceTest() { csvParserServiceMock = new Mock <ICsvParserService>(); elasticClientMock = new Mock <IElasticClient>(); loggerMock = new Mock <ILogger <BookService> >(); goodBooksContext = GetDbContext(); mapper = GetMapper(); bookService = new BookService(goodBooksContext, csvParserServiceMock.Object, mapper, elasticClientMock.Object, loggerMock.Object); }
public BookService(GoodBooksContext context, ICsvParserService csvParserService, IMapper mapper, IElasticClient elasticClient, ILogger <BookService> logger) { this.context = context; this.csvParserService = csvParserService; this.mapper = mapper; this.elasticClient = elasticClient; this.logger = logger; }
private GoodBooksContext GetDbContext() { dbConnection = new SqliteConnection("DataSource=:memory:"); dbConnection.Open(); var option = new DbContextOptionsBuilder <GoodBooksContext>() .UseSqlite(dbConnection).Options; var context = new GoodBooksContext(option); context.Database.EnsureCreated(); return(context); }
public ReviewService(GoodBooksContext context, IMapper mapper) { this.context = context; this.mapper = mapper; }