public UsersControllerTests() { // Initialize the database in memory var dbContext = DbContextMocker.GetHomeDBContext(); // Logger _mockLogger = new Mock <ILogger <UsersController> >(); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperProfile()); }); // Mapper _mockMapper = mockMapper.CreateMapper(); // Service / Repository _repository = new UsersRepository(dbContext); // Controller _usersController = new UsersController(_mockLogger.Object, _repository, _mockMapper, _appSettings); }
public AlbumsControllerTests() { // 1. Arrange: Prepare for the test // Initialize the database in memory var dbContext = DbContextMocker.GetHomeDBContext(); // Logger _mockLogger = new Mock <ILogger <AlbumsController> >(); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperProfile()); }); // Mapper _mockMapper = mockMapper.CreateMapper(); // Service / Repository _repository = new AlbumRepository(dbContext); // Controller _albumsController = new AlbumsController(_mockLogger.Object, _repository, _mockMapper); }