Ejemplo n.º 1
0
        public ReviewServiceTest()
        {
            goodBooksContext = GetDbContext();
            mapper           = GetMapper();

            reviewService = new ReviewService(goodBooksContext, mapper);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public ReviewService(GoodBooksContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }